Преглед изворни кода

* tsymlist.def renamed to tsymlist.procdef
* tsymlist.procdef is now only used to store the procdef

peter пре 22 година
родитељ
комит
625de786dc
4 измењених фајлова са 68 додато и 54 уклоњено
  1. 40 33
      compiler/pdecobj.pas
  2. 10 4
      compiler/symdef.pas
  3. 7 3
      compiler/symppu.pas
  4. 11 14
      compiler/symtype.pas

+ 40 - 33
compiler/pdecobj.pas

@@ -38,7 +38,6 @@ implementation
       cutils,cclasses,
       cutils,cclasses,
       globals,verbose,systems,tokens,
       globals,verbose,systems,tokens,
       symconst,symbase,symsym,symtable,defutil,defcmp,
       symconst,symbase,symsym,symtable,defutil,defcmp,
-      cgbase,
       node,nld,nmem,ncon,ncnv,ncal,pass_1,
       node,nld,nmem,ncon,ncnv,ncal,pass_1,
       scanner,
       scanner,
       pbase,pexpr,pdecsub,pdecvar,ptype
       pbase,pexpr,pdecsub,pdecvar,ptype
@@ -89,14 +88,13 @@ implementation
 
 
         { convert a node tree to symlist and return the last
         { convert a node tree to symlist and return the last
           symbol }
           symbol }
-        function parse_symlist(pl:tsymlist):boolean;
+        function parse_symlist(pl:tsymlist;var def:tdef):boolean;
           var
           var
             idx : longint;
             idx : longint;
             sym : tsym;
             sym : tsym;
-            def : tdef;
             st  : tsymtable;
             st  : tsymtable;
           begin
           begin
-            parse_symlist:=true;
+            result:=true;
             def:=nil;
             def:=nil;
             if token=_ID then
             if token=_ID then
              begin
              begin
@@ -118,7 +116,7 @@ implementation
                else
                else
                 begin
                 begin
                   Message1(parser_e_illegal_field_or_method,pattern);
                   Message1(parser_e_illegal_field_or_method,pattern);
-                  parse_symlist:=false;
+                  result:=false;
                 end;
                 end;
                consume(_ID);
                consume(_ID);
                repeat
                repeat
@@ -146,21 +144,26 @@ implementation
                                   else
                                   else
                                     begin
                                     begin
                                       Message1(sym_e_illegal_field,pattern);
                                       Message1(sym_e_illegal_field,pattern);
-                                      parse_symlist:=false;
+                                      result:=false;
                                     end;
                                     end;
                                 end;
                                 end;
                               end
                               end
                              else
                              else
                               begin
                               begin
                                 Message1(sym_e_illegal_field,pattern);
                                 Message1(sym_e_illegal_field,pattern);
-                                parse_symlist:=false;
+                                result:=false;
                               end;
                               end;
                            end
                            end
                           else
                           else
                            begin
                            begin
                              Message(cg_e_invalid_qualifier);
                              Message(cg_e_invalid_qualifier);
-                             parse_symlist:=false;
+                             result:=false;
                            end;
                            end;
+                        end
+                       else
+                        begin
+                          Message(cg_e_invalid_qualifier);
+                          result:=false;
                         end;
                         end;
                        consume(_ID);
                        consume(_ID);
                      end;
                      end;
@@ -177,7 +180,7 @@ implementation
                          else
                          else
                           begin
                           begin
                             Message(cg_e_invalid_qualifier);
                             Message(cg_e_invalid_qualifier);
-                            parse_symlist:=false;
+                            result:=false;
                           end;
                           end;
                        until not try_to_consume(_COMMA);
                        until not try_to_consume(_COMMA);
                        consume(_RECKKLAMMER);
                        consume(_RECKKLAMMER);
@@ -185,7 +188,7 @@ implementation
                    else
                    else
                      begin
                      begin
                        Message(parser_e_ill_property_access_sym);
                        Message(parser_e_ill_property_access_sym);
-                       parse_symlist:=false;
+                       result:=false;
                        break;
                        break;
                      end;
                      end;
                  end;
                  end;
@@ -194,9 +197,8 @@ implementation
             else
             else
              begin
              begin
                Message(parser_e_ill_property_access_sym);
                Message(parser_e_ill_property_access_sym);
-               parse_symlist:=false;
+               result:=false;
              end;
              end;
-            pl.def:=def;
           end;
           end;
 
 
         var
         var
@@ -208,8 +210,7 @@ implementation
            s : string;
            s : string;
            tt : ttype;
            tt : ttype;
            arraytype : ttype;
            arraytype : ttype;
-           pp : Tprocdef;
-           pd : tprocdef;
+           def : tdef;
            pt : tnode;
            pt : tnode;
            propname : stringid;
            propname : stringid;
            sc : tsinglelist;
            sc : tsinglelist;
@@ -375,7 +376,7 @@ implementation
            if try_to_consume(_READ) then
            if try_to_consume(_READ) then
             begin
             begin
               p.readaccess.clear;
               p.readaccess.clear;
-              if parse_symlist(p.readaccess) then
+              if parse_symlist(p.readaccess,def) then
                begin
                begin
                  sym:=p.readaccess.firstsym^.sym;
                  sym:=p.readaccess.firstsym^.sym;
                  case sym.typ of
                  case sym.typ of
@@ -386,14 +387,15 @@ implementation
                        { Insert hidden parameters }
                        { Insert hidden parameters }
                        calc_parast(readprocdef);
                        calc_parast(readprocdef);
                        { search procdefs matching readprocdef }
                        { search procdefs matching readprocdef }
-                       pd:=Tprocsym(sym).search_procdef_bypara(readprocdef.para,p.proptype.def,true,false);
-                       if not(assigned(pd)) then
+                       p.readaccess.procdef:=Tprocsym(sym).search_procdef_bypara(readprocdef.para,p.proptype.def,true,false);
+                       if not assigned(p.readaccess.procdef) then
                          Message(parser_e_ill_property_access_sym);
                          Message(parser_e_ill_property_access_sym);
-                       p.readaccess.setdef(pd);
                      end;
                      end;
                    varsym :
                    varsym :
                      begin
                      begin
-                       if compare_defs(p.readaccess.def,p.proptype.def,nothingn)>=te_equal then
+                       if not assigned(def) then
+                         internalerror(200310071);
+                       if compare_defs(def,p.proptype.def,nothingn)>=te_equal then
                         begin
                         begin
                           { property parameters are allowed if this is
                           { property parameters are allowed if this is
                             an indexed property, because the index is then
                             an indexed property, because the index is then
@@ -404,7 +406,7 @@ implementation
                            Message(parser_e_ill_property_access_sym);
                            Message(parser_e_ill_property_access_sym);
                         end
                         end
                        else
                        else
-                        CGMessage2(type_e_incompatible_types,p.readaccess.def.typename,p.proptype.def.typename);
+                        CGMessage2(type_e_incompatible_types,def.typename,p.proptype.def.typename);
                      end;
                      end;
                    else
                    else
                      Message(parser_e_ill_property_access_sym);
                      Message(parser_e_ill_property_access_sym);
@@ -414,7 +416,7 @@ implementation
            if try_to_consume(_WRITE) then
            if try_to_consume(_WRITE) then
             begin
             begin
               p.writeaccess.clear;
               p.writeaccess.clear;
-              if parse_symlist(p.writeaccess) then
+              if parse_symlist(p.writeaccess,def) then
                begin
                begin
                  sym:=p.writeaccess.firstsym^.sym;
                  sym:=p.writeaccess.firstsym^.sym;
                  case sym.typ of
                  case sym.typ of
@@ -429,14 +431,15 @@ implementation
                        { Insert hidden parameters }
                        { Insert hidden parameters }
                        calc_parast(writeprocdef);
                        calc_parast(writeprocdef);
                        { search procdefs matching writeprocdef }
                        { search procdefs matching writeprocdef }
-                       pd:=Tprocsym(sym).search_procdef_bypara(writeprocdef.para,writeprocdef.rettype.def,true,false);
-                       if not(assigned(pd)) then
+                       p.writeaccess.procdef:=Tprocsym(sym).search_procdef_bypara(writeprocdef.para,writeprocdef.rettype.def,true,false);
+                       if not assigned(p.writeaccess.procdef) then
                          Message(parser_e_ill_property_access_sym);
                          Message(parser_e_ill_property_access_sym);
-                       p.writeaccess.setdef(pd);
                      end;
                      end;
                    varsym :
                    varsym :
                      begin
                      begin
-                       if compare_defs(p.writeaccess.def,p.proptype.def,nothingn)>=te_equal then
+                       if not assigned(def) then
+                         internalerror(200310072);
+                       if compare_defs(def,p.proptype.def,nothingn)>=te_equal then
                         begin
                         begin
                           { property parameters are allowed if this is
                           { property parameters are allowed if this is
                             an indexed property, because the index is then
                             an indexed property, because the index is then
@@ -447,7 +450,7 @@ implementation
                            Message(parser_e_ill_property_access_sym);
                            Message(parser_e_ill_property_access_sym);
                         end
                         end
                        else
                        else
-                        CGMessage2(type_e_incompatible_types,p.readaccess.def.typename,p.proptype.def.typename);
+                        CGMessage2(type_e_incompatible_types,def.typename,p.proptype.def.typename);
                      end;
                      end;
                    else
                    else
                      Message(parser_e_ill_property_access_sym);
                      Message(parser_e_ill_property_access_sym);
@@ -467,22 +470,22 @@ implementation
                     { as stored true                    }
                     { as stored true                    }
                     if idtoken<>_DEFAULT then
                     if idtoken<>_DEFAULT then
                      begin
                      begin
-                       if parse_symlist(p.storedaccess) then
+                       if parse_symlist(p.storedaccess,def) then
                         begin
                         begin
                           sym:=p.storedaccess.firstsym^.sym;
                           sym:=p.storedaccess.firstsym^.sym;
                           case sym.typ of
                           case sym.typ of
                             procsym :
                             procsym :
                               begin
                               begin
-                                 pp:=Tprocsym(sym).search_procdef_nopara_boolret;
-                                 if assigned(pp) then
-                                   p.storedaccess.setdef(pp)
-                                 else
+                                 p.storedaccess.procdef:=Tprocsym(sym).search_procdef_nopara_boolret;
+                                 if not assigned(p.storedaccess.procdef) then
                                    message(parser_e_ill_property_storage_sym);
                                    message(parser_e_ill_property_storage_sym);
                               end;
                               end;
                             varsym :
                             varsym :
                               begin
                               begin
+                                if not assigned(def) then
+                                  internalerror(200310073);
                                 if (ppo_hasparameters in p.propoptions) or
                                 if (ppo_hasparameters in p.propoptions) or
-                                   not(is_boolean(p.storedaccess.def)) then
+                                   not(is_boolean(def)) then
                                  Message(parser_e_stored_property_must_be_boolean);
                                  Message(parser_e_stored_property_must_be_boolean);
                               end;
                               end;
                             else
                             else
@@ -1155,7 +1158,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.68  2003-10-02 21:15:12  peter
+  Revision 1.69  2003-10-07 16:06:30  peter
+    * tsymlist.def renamed to tsymlist.procdef
+    * tsymlist.procdef is now only used to store the procdef
+
+  Revision 1.68  2003/10/02 21:15:12  peter
     * support nil as default value
     * support nil as default value
     * when no default property is allowed don't check default value
     * when no default property is allowed don't check default value
 
 

+ 10 - 4
compiler/symdef.pas

@@ -5118,16 +5118,18 @@ implementation
              end
              end
            else
            else
              begin
              begin
-                if not(po_virtualmethod in tprocdef(proc.def).procoptions) then
+                if not assigned(proc.procdef) then
+                  internalerror(200310074);
+                if not(po_virtualmethod in tprocdef(proc.procdef).procoptions) then
                   begin
                   begin
-                     rttiList.concat(Tai_const_symbol.Createname(tprocdef(proc.def).mangledname));
+                     rttiList.concat(Tai_const_symbol.Createname(tprocdef(proc.procdef).mangledname));
                      typvalue:=1;
                      typvalue:=1;
                   end
                   end
                 else
                 else
                   begin
                   begin
                      { virtual method, write vmt offset }
                      { virtual method, write vmt offset }
                      rttiList.concat(Tai_const.Create_32bit(
                      rttiList.concat(Tai_const.Create_32bit(
-                       tprocdef(proc.def)._class.vmtmethodoffset(tprocdef(proc.def).extnumber)));
+                       tprocdef(proc.procdef)._class.vmtmethodoffset(tprocdef(proc.procdef).extnumber)));
                      typvalue:=2;
                      typvalue:=2;
                   end;
                   end;
              end;
              end;
@@ -5913,7 +5915,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.173  2003-10-06 22:23:41  florian
+  Revision 1.174  2003-10-07 16:06:30  peter
+    * tsymlist.def renamed to tsymlist.procdef
+    * tsymlist.procdef is now only used to store the procdef
+
+  Revision 1.173  2003/10/06 22:23:41  florian
     + added basic olevariant support
     + added basic olevariant support
 
 
   Revision 1.172  2003/10/05 21:21:52  peter
   Revision 1.172  2003/10/05 21:21:52  peter

+ 7 - 3
compiler/symppu.pas

@@ -179,7 +179,7 @@ implementation
         p   : tsymlist;
         p   : tsymlist;
       begin
       begin
         p:=tsymlist.create;
         p:=tsymlist.create;
-        getderef(p.defderef);
+        getderef(p.procdefderef);
         repeat
         repeat
           slt:=tsltype(getbyte);
           slt:=tsltype(getbyte);
           case slt of
           case slt of
@@ -344,7 +344,7 @@ implementation
       var
       var
         hp : psymlistitem;
         hp : psymlistitem;
       begin
       begin
-        putderef(p.def,p.defderef);
+        putderef(p.procdef,p.procdefderef);
         hp:=p.firstsym;
         hp:=p.firstsym;
         while assigned(hp) do
         while assigned(hp) do
          begin
          begin
@@ -405,7 +405,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.19  2003-06-07 20:26:32  peter
+  Revision 1.20  2003-10-07 16:06:30  peter
+    * tsymlist.def renamed to tsymlist.procdef
+    * tsymlist.procdef is now only used to store the procdef
+
+  Revision 1.19  2003/06/07 20:26:32  peter
     * re-resolving added instead of reloading from ppu
     * re-resolving added instead of reloading from ppu
     * tderef object added to store deref info for resolving
     * tderef object added to store deref info for resolving
 
 

+ 11 - 14
compiler/symtype.pas

@@ -143,14 +143,13 @@ interface
       end;
       end;
 
 
       tsymlist = class
       tsymlist = class
-        def      : tdef;
-        defderef : tderef;
+        procdef  : tdef;
+        procdefderef : tderef;
         firstsym,
         firstsym,
         lastsym  : psymlistitem;
         lastsym  : psymlistitem;
         constructor create;
         constructor create;
         destructor  destroy;override;
         destructor  destroy;override;
         function  empty:boolean;
         function  empty:boolean;
-        procedure setdef(p:tdef);
         procedure addsym(slt:tsltype;p:tsym);
         procedure addsym(slt:tsltype;p:tsym);
         procedure addsymderef(slt:tsltype;const d:tderef);
         procedure addsymderef(slt:tsltype;const d:tderef);
         procedure addconst(slt:tsltype;v:longint);
         procedure addconst(slt:tsltype;v:longint);
@@ -366,7 +365,7 @@ implementation
 
 
     constructor tsymlist.create;
     constructor tsymlist.create;
       begin
       begin
-        def:=nil; { needed for procedures }
+        procdef:=nil; { needed for procedures }
         firstsym:=nil;
         firstsym:=nil;
         lastsym:=nil;
         lastsym:=nil;
       end;
       end;
@@ -396,13 +395,7 @@ implementation
          end;
          end;
         firstsym:=nil;
         firstsym:=nil;
         lastsym:=nil;
         lastsym:=nil;
-        def:=nil;
-      end;
-
-
-    procedure tsymlist.setdef(p:tdef);
-      begin
-        def:=p;
+        procdef:=nil;
       end;
       end;
 
 
 
 
@@ -469,7 +462,7 @@ implementation
         hpn : psymlistitem;
         hpn : psymlistitem;
       begin
       begin
         hp:=tsymlist.create;
         hp:=tsymlist.create;
-        hp.def:=def;
+        hp.procdef:=procdef;
         hp2:=firstsym;
         hp2:=firstsym;
         while assigned(hp2) do
         while assigned(hp2) do
          begin
          begin
@@ -491,7 +484,7 @@ implementation
       var
       var
         hp : psymlistitem;
         hp : psymlistitem;
       begin
       begin
-        def:=tdef(defderef.resolve);
+        procdef:=tdef(procdefderef.resolve);
         hp:=firstsym;
         hp:=firstsym;
         while assigned(hp) do
         while assigned(hp) do
          begin
          begin
@@ -865,7 +858,11 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.27  2003-09-14 12:58:29  peter
+  Revision 1.28  2003-10-07 16:06:30  peter
+    * tsymlist.def renamed to tsymlist.procdef
+    * tsymlist.procdef is now only used to store the procdef
+
+  Revision 1.27  2003/09/14 12:58:29  peter
     * give IE when st is not assigned in deref
     * give IE when st is not assigned in deref
 
 
   Revision 1.26  2003/06/25 18:31:23  peter
   Revision 1.26  2003/06/25 18:31:23  peter