Browse Source

* po_addressonly added to retrieve the address of a methodpointer
only, this is used for @tclass.method which has no self pointer

peter 22 years ago
parent
commit
80b463da2e
3 changed files with 25 additions and 6 deletions
  1. 11 2
      compiler/nmem.pas
  2. 7 2
      compiler/symconst.pas
  3. 7 2
      compiler/symdef.pas

+ 11 - 2
compiler/nmem.pas

@@ -300,7 +300,7 @@ implementation
       end;
 
     procedure Taddrnode.mark_write;
-    
+
     begin
       {@procvar:=nil is legal in Delphi mode.}
       left.mark_write;
@@ -420,6 +420,11 @@ implementation
                  if (hp3.owner.symtabletype=objectsymtable) then
                    include(tprocvardef(resulttype.def).procoptions,po_methodpointer);
 
+                 { only need the address of the method? this is needed
+                   for @tobject.create }
+                 if not assigned(tloadnode(left).left) then
+                   include(tprocvardef(resulttype.def).procoptions,po_addressonly);
+
                  { we need to process the parameters reverse so they are inserted
                    in the correct right2left order (PFV) }
                  hp2:=TParaItem(hp3.Para.last);
@@ -1050,7 +1055,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.43  2003-01-04 15:54:03  daniel
+  Revision 1.44  2003-01-06 21:16:52  peter
+    * po_addressonly added to retrieve the address of a methodpointer
+      only, this is used for @tclass.method which has no self pointer
+
+  Revision 1.43  2003/01/04 15:54:03  daniel
     * Fixed mark_write for @ operator
       (can happen when compiling @procvar:=nil (Delphi mode construction))
 

+ 7 - 2
compiler/symconst.pas

@@ -198,7 +198,8 @@ type
     po_varargs,           { printf like arguments }
     po_leftright,         { push arguments from left to right }
     po_clearstack,        { caller clears the stack }
-    po_internconst        { procedure has constant evaluator intern }
+    po_internconst,       { procedure has constant evaluator intern }
+    po_addressonly        { flag that only the address of a method is returned and not a full methodpointer }
   );
   tprocoptions=set of tprocoption;
 
@@ -342,7 +343,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.43  2003-01-05 15:54:15  florian
+  Revision 1.44  2003-01-06 21:16:52  peter
+    * po_addressonly added to retrieve the address of a methodpointer
+      only, this is used for @tclass.method which has no self pointer
+
+  Revision 1.43  2003/01/05 15:54:15  florian
     + added proper support of type = type <type>; for simple types
 
   Revision 1.42  2003/01/05 13:36:53  florian

+ 7 - 2
compiler/symdef.pas

@@ -4011,7 +4011,8 @@ implementation
 
     function tprocvardef.size : longint;
       begin
-         if (po_methodpointer in procoptions) then
+         if (po_methodpointer in procoptions) and
+            not(po_addressonly in procoptions) then
            size:=2*POINTER_SIZE
          else
            size:=POINTER_SIZE;
@@ -5597,7 +5598,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.122  2003-01-05 15:54:15  florian
+  Revision 1.123  2003-01-06 21:16:52  peter
+    * po_addressonly added to retrieve the address of a methodpointer
+      only, this is used for @tclass.method which has no self pointer
+
+  Revision 1.122  2003/01/05 15:54:15  florian
     + added proper support of type = type <type>; for simple types
 
   Revision 1.121  2003/01/05 13:36:53  florian