Browse Source

* pi_is_global was missing for global methods
+ code to restore overloaded list order
(necessary to get same CRC values after interface and after
implementation)

pierre 26 years ago
parent
commit
154386ac6a
1 changed files with 27 additions and 4 deletions
  1. 27 4
      compiler/psub.pas

+ 27 - 4
compiler/psub.pas

@@ -326,6 +326,9 @@ begin
           consume(_ID);
           consume(_ID);
           procinfo._class:=pobjectdef(ptypesym(sym)^.definition);
           procinfo._class:=pobjectdef(ptypesym(sym)^.definition);
           aktprocsym:=pprocsym(procinfo._class^.symtable^.search(sp));
           aktprocsym:=pprocsym(procinfo._class^.symtable^.search(sp));
+          {The procedure has been found. So it is
+           a global one. Set the flags to mark this.}
+          procinfo.flags:=procinfo.flags or pi_is_global;
           aktobjectdef:=nil;
           aktobjectdef:=nil;
           { we solve this below }
           { we solve this below }
           if not(assigned(aktprocsym)) then
           if not(assigned(aktprocsym)) then
@@ -1296,7 +1299,7 @@ end;
 
 
 {***************************************************************************}
 {***************************************************************************}
 
 
-function check_identical : boolean;
+function check_identical(var p : pprocdef) : boolean;
 {
 {
   Search for idendical definitions,
   Search for idendical definitions,
   if there is a forward, then kill this.
   if there is a forward, then kill this.
@@ -1312,6 +1315,7 @@ var
   s : string;
   s : string;
 begin
 begin
   check_identical:=false;
   check_identical:=false;
+  p:=nil;
   pd:=aktprocsym^.definition;
   pd:=aktprocsym^.definition;
   if assigned(pd) then
   if assigned(pd) then
    begin
    begin
@@ -1440,6 +1444,10 @@ begin
                         hd^.parast:=aktprocsym^.definition^.parast;
                         hd^.parast:=aktprocsym^.definition^.parast;
                         aktprocsym^.definition^.parast:=storeparast;
                         aktprocsym^.definition^.parast:=storeparast;
                      end;
                      end;
+                   if pd=aktprocsym^.definition then
+                     p:=nil
+                   else
+                     p:=pd;
                    aktprocsym^.definition:=hd;
                    aktprocsym^.definition:=hd;
                    check_identical:=true;
                    check_identical:=true;
                  end
                  end
@@ -1893,8 +1901,9 @@ var
   oldprocinfo      : tprocinfo;
   oldprocinfo      : tprocinfo;
   oldconstsymtable : Psymtable;
   oldconstsymtable : Psymtable;
   oldfilepos       : tfileposinfo;
   oldfilepos       : tfileposinfo;
-  names     : Pstringcontainer;
+  names           : Pstringcontainer;
   pdflags         : word;
   pdflags         : word;
+  prevdef,stdef   : pprocdef;
 begin
 begin
 { save old state }
 { save old state }
    oldprocsym:=aktprocsym;
    oldprocsym:=aktprocsym;
@@ -1953,7 +1962,7 @@ begin
    aktfilepos:=aktprocsym^.definition^.fileinfo;
    aktfilepos:=aktprocsym^.definition^.fileinfo;
 
 
 { search for forward declarations }
 { search for forward declarations }
-   if not check_identical then
+   if not check_identical(prevdef) then
      begin
      begin
      { A method must be forward defined (in the object declaration) }
      { A method must be forward defined (in the object declaration) }
        if assigned(procinfo._class) and (not assigned(oldprocinfo._class)) then
        if assigned(procinfo._class) and (not assigned(oldprocinfo._class)) then
@@ -2024,6 +2033,14 @@ begin
    { from now on all refernece to mangledname means
    { from now on all refernece to mangledname means
      that the function is already used }
      that the function is already used }
    aktprocsym^.definition^.count:=true;
    aktprocsym^.definition^.count:=true;
+   { restore the interface order to maintain CRC values PM }
+   if assigned(prevdef) and assigned(aktprocsym^.definition^.nextoverloaded) then
+     begin
+       stdef:=aktprocsym^.definition;
+       aktprocsym^.definition:=stdef^.nextoverloaded;
+       stdef^.nextoverloaded:=prevdef^.nextoverloaded;
+       prevdef^.nextoverloaded:=stdef;
+     end;
    aktprocsym:=oldprocsym;
    aktprocsym:=oldprocsym;
    procprefix:=oldprefix;
    procprefix:=oldprefix;
    procinfo:=oldprocinfo;
    procinfo:=oldprocinfo;
@@ -2034,7 +2051,13 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.15  1999-08-19 13:02:11  pierre
+  Revision 1.16  1999-08-27 10:41:46  pierre
+    * pi_is_global was missing for global methods
+    + code to restore overloaded list order
+      (necessary to get same CRC values after interface and after
+      implementation)
+
+  Revision 1.15  1999/08/19 13:02:11  pierre
     + label faillabel added for _FAIL support
     + label faillabel added for _FAIL support
 
 
   Revision 1.14  1999/08/10 16:24:44  pierre
   Revision 1.14  1999/08/10 16:24:44  pierre