Browse Source

* some interfaces related problems regarding
mapping of interface implementions fixed

florian 24 years ago
parent
commit
032023f8de
5 changed files with 60 additions and 29 deletions
  1. 13 8
      compiler/nobj.pas
  2. 21 11
      compiler/pdecobj.pas
  3. 14 6
      compiler/pdecsub.pas
  4. 6 2
      compiler/pexpr.pas
  5. 6 2
      compiler/symdef.pas

+ 13 - 8
compiler/nobj.pas

@@ -119,10 +119,10 @@ interface
 
       tclassheaderclass=class of tclassheader;
 
-    var     
+    var
       cclassheader : tclassheaderclass;
 
-      
+
 implementation
 
     uses
@@ -630,8 +630,8 @@ implementation
                                        if (procdefcoll^.data.proccalloptions<>hp.proccalloptions) or
                                           (procdefcoll^.data.proctypeoption<>hp.proctypeoption) or
                                           ((procdefcoll^.data.procoptions-
-                                              [po_abstractmethod,po_overridingmethod,po_assembler])<>
-                                           (hp.procoptions-[po_abstractmethod,po_overridingmethod,po_assembler])) then
+                                              [po_abstractmethod,po_overridingmethod,po_assembler,po_overload])<>
+                                           (hp.procoptions-[po_abstractmethod,po_overridingmethod,po_assembler,po_overload])) then
                                          Message1(parser_e_header_dont_match_forward,hp.fullprocname);
 
                                        { check, if the overridden directive is set }
@@ -1021,11 +1021,11 @@ implementation
       begin
         implprocdef:=nil;
         sym:=tprocsym(search_class_member(_class,name));
-        if assigned(sym) and (sym.typ=procsym) and not (sp_private in sym.symoptions) then
+        if assigned(sym) and (sym.typ=procsym) then
           begin
             implprocdef:=sym.definition;
             while assigned(implprocdef) and not equal_paras(proc.para,implprocdef.para,cp_none) and
-                  (proc.proccalloptions<>implprocdef.proccalloptions) do
+              (proc.proccalloptions<>implprocdef.proccalloptions) do
               implprocdef:=implprocdef.nextoverloaded;
           end;
         gintfgetcprocdef:=implprocdef;
@@ -1052,7 +1052,8 @@ implementation
                 repeat
                   mappedname:=_class.implementedinterfaces.getmappings(intfindex,proc.procsym.name,nextexist);
                   if procname='' then
-                    procname:=mappedname; { for error messages }
+                    procname:=proc.procsym.name;
+                    //mappedname; { for error messages }
                   if mappedname<>'' then
                     implprocdef:=gintfgetcprocdef(proc,mappedname);
                 until assigned(implprocdef) or not assigned(nextexist);
@@ -1272,7 +1273,11 @@ initialization
 end.
 {
   $Log$
-  Revision 1.1  2001-04-21 13:37:16  peter
+  Revision 1.2  2001-08-22 21:16:20  florian
+    * some interfaces related problems regarding
+      mapping of interface implementions fixed
+
+  Revision 1.1  2001/04/21 13:37:16  peter
     * made tclassheader using class of to implement cpu dependent code
 
   Revision 1.20  2001/04/18 22:01:54  peter

+ 21 - 11
compiler/pdecobj.pas

@@ -934,21 +934,27 @@ implementation
                       oldparse_only:=parse_only;
                       parse_only:=true;
                       parse_proc_dec;
+                      { this is for error recovery as well as forward }
+                      { interface mappings, i.e. mapping to a method  }
+                      { which isn't declared yet                      }
+                      if assigned(aktprocsym) then
+                        begin
 {$ifndef newcg}
-                      parse_object_proc_directives(aktprocsym);
+                            parse_object_proc_directives(aktprocsym);
 {$endif newcg}
-                      { check if there are duplicates }
-                      check_identical_proc(temppd);
-                      if (po_msgint in aktprocsym.definition.procoptions) then
-                        include(aktclass.objectoptions,oo_has_msgint);
+                            { check if there are duplicates }
+                            check_identical_proc(temppd);
+                            if (po_msgint in aktprocsym.definition.procoptions) then
+                             include(aktclass.objectoptions,oo_has_msgint);
 
-                      if (po_msgstr in aktprocsym.definition.procoptions) then
-                        include(aktclass.objectoptions,oo_has_msgstr);
+                            if (po_msgstr in aktprocsym.definition.procoptions) then
+                              include(aktclass.objectoptions,oo_has_msgstr);
 
-                      if (po_virtualmethod in aktprocsym.definition.procoptions) then
-                        include(aktclass.objectoptions,oo_has_virtual);
+                            if (po_virtualmethod in aktprocsym.definition.procoptions) then
+                              include(aktclass.objectoptions,oo_has_virtual);
 
-                      chkcpp;
+                            chkcpp;
+                         end;
 
                       parse_only:=oldparse_only;
                     end;
@@ -1039,7 +1045,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.26  2001-06-03 21:57:36  peter
+  Revision 1.27  2001-08-22 21:16:20  florian
+    * some interfaces related problems regarding
+      mapping of interface implementions fixed
+
+  Revision 1.26  2001/06/03 21:57:36  peter
     + hint directive parsing support
 
   Revision 1.25  2001/05/04 15:52:03  florian

+ 14 - 6
compiler/pdecsub.pas

@@ -378,12 +378,14 @@ begin
          else
            begin
               aktprocsym:=tprocsym(procinfo^._class.implementedinterfaces.interfaces(i).symtable.search(sp));
-              if not(assigned(aktprocsym)) then
-                Message(parser_e_methode_id_expected);
+              { the method can be declared after the mapping FK
+                if not(assigned(aktprocsym)) then
+                  Message(parser_e_methode_id_expected);
+              }
            end;
          consume(_ID);
          consume(_EQUAL);
-         if (token=_ID) and assigned(aktprocsym) then
+         if (token=_ID) { and assigned(aktprocsym) } then
            procinfo^._class.implementedinterfaces.addmappings(i,sp,pattern);
          consume(_ID);
          exit;
@@ -663,7 +665,8 @@ begin
                    parse_proc_head(potype_none);
                    if token<>_COLON then
                     begin
-                       if not(is_interface(aktprocsym.definition._class)) and
+                       if assigned(aktprocsym) and
+                          not(is_interface(aktprocsym.definition._class)) and
                           not(aktprocsym.definition.forwarddef) or
                          (m_repeat_forward in aktmodeswitches) then
                        begin
@@ -683,7 +686,8 @@ begin
     _PROCEDURE : begin
                    consume(_PROCEDURE);
                    parse_proc_head(potype_none);
-                   aktprocsym.definition.rettype:=voidtype;
+                   if assigned(aktprocsym) then
+                     aktprocsym.definition.rettype:=voidtype;
                  end;
   _CONSTRUCTOR : begin
                    consume(_CONSTRUCTOR);
@@ -1914,7 +1918,11 @@ const
 end.
 {
   $Log$
-  Revision 1.33  2001-08-19 21:11:20  florian
+  Revision 1.34  2001-08-22 21:16:21  florian
+    * some interfaces related problems regarding
+      mapping of interface implementions fixed
+
+  Revision 1.33  2001/08/19 21:11:20  florian
     * some bugs fix:
       - overload; with external procedures fixed
       - better selection of routine to do an overloaded

+ 6 - 2
compiler/pexpr.pas

@@ -870,7 +870,7 @@ implementation
                 end;
 
               { we assume, that only procsyms and varsyms are in an object }
-              { symbol table, for classes, properties are allowed         }
+              { symbol table, for classes, properties are allowed          }
               case sym.typ of
                  procsym:
                    begin
@@ -2324,7 +2324,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.39  2001-08-06 21:40:47  peter
+  Revision 1.40  2001-08-22 21:16:21  florian
+    * some interfaces related problems regarding
+      mapping of interface implementions fixed
+
+  Revision 1.39  2001/08/06 21:40:47  peter
     * funcret moved from tprocinfo to tprocdef
 
   Revision 1.38  2001/07/09 21:15:41  peter

+ 6 - 2
compiler/symdef.pas

@@ -3258,7 +3258,7 @@ implementation
       begin
         s:='';
         first:=true;
-        for i:=1to proccallopts do
+        for i:=1 to proccallopts do
          if (proccallopt[i].mask in proccalloptions) then
           begin
             if first then
@@ -5489,7 +5489,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.43  2001-08-19 09:39:27  peter
+  Revision 1.44  2001-08-22 21:16:22  florian
+    * some interfaces related problems regarding
+      mapping of interface implementions fixed
+
+  Revision 1.43  2001/08/19 09:39:27  peter
     * local browser support fixed
 
   Revision 1.41  2001/08/12 20:04:33  peter