Procházet zdrojové kódy

* allow typeof(self) in class methods

peter před 22 roky
rodič
revize
17d7fb5a03
1 změnil soubory, kde provedl 11 přidání a 2 odebrání
  1. 11 2
      compiler/pexpr.pas

+ 11 - 2
compiler/pexpr.pas

@@ -314,7 +314,13 @@ implementation
               consume(_RKLAMMER);
               if p1.nodetype=typen then
                 ttypenode(p1).allowed:=true;
-              if (p1.resulttype.def.deftype = objectdef) then
+              { Allow classrefdef, which is required for
+                Typeof(self) in static class methods }
+              if (p1.resulttype.def.deftype = objectdef) or
+                 (assigned(current_procinfo) and
+                  ((po_classmethod in current_procinfo.procdef.procoptions) or
+                   (po_staticmethod in current_procinfo.procdef.procoptions)) and
+                  (p1.resulttype.def.deftype=classrefdef)) then
                statement_syssym:=geninlinenode(in_typeof_x,false,p1)
               else
                begin
@@ -2413,7 +2419,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.124  2003-08-10 17:25:23  peter
+  Revision 1.125  2003-08-23 18:41:52  peter
+    * allow typeof(self) in class methods
+
+  Revision 1.124  2003/08/10 17:25:23  peter
     * fixed some reported bugs
 
   Revision 1.123  2003/06/13 21:19:31  peter