2
0
Эх сурвалжийг харах

ncal.pas, tcallnode.gen_hidden_parameters: for helpers the extended type needs to be checked for a VMT not the helper, because helper never have one; this fixes that "Self" was Nil inside of class methods.

git-svn-id: branches/svenbarth/classhelpers@17833 -
svenbarth 14 жил өмнө
parent
commit
906d4cd8a8

+ 8 - 1
compiler/ncal.pas

@@ -1638,6 +1638,7 @@ implementation
     function tcallnode.gen_self_tree:tnode;
     function tcallnode.gen_self_tree:tnode;
       var
       var
         selftree : tnode;
         selftree : tnode;
+        selfdef  : tabstractrecorddef;
       begin
       begin
         selftree:=nil;
         selftree:=nil;
 
 
@@ -1685,7 +1686,13 @@ implementation
             begin
             begin
               if (procdefinition.typ<>procdef) then
               if (procdefinition.typ<>procdef) then
                 internalerror(200305062);
                 internalerror(200305062);
-              if (oo_has_vmt in tprocdef(procdefinition).struct.objectoptions) then
+              { if the method belongs to a helper then we need to use the
+                extended type for references to Self }
+              if is_objectpascal_helper(tprocdef(procdefinition).struct) then
+                selfdef:=tobjectdef(tprocdef(procdefinition).struct).extendeddef
+              else
+                selfdef:=tprocdef(procdefinition).struct;
+              if (oo_has_vmt in selfdef.objectoptions) then
                 begin
                 begin
                   { we only need the vmt, loading self is not required and there is no
                   { we only need the vmt, loading self is not required and there is no
                     need to check for typen, because that will always get the
                     need to check for typen, because that will always get the