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

* type redefine fix for tb0437

peter 22 жил өмнө
parent
commit
a261bbcfac

+ 10 - 6
compiler/ptype.pas

@@ -158,12 +158,13 @@ implementation
             tt:=generrortype;
             exit;
           end;
-         { Only use the definitions for current unit, becuase
+         { Use the definitions for current unit, becuase
            they can be refered from the parameters and symbols are not
-           loaded at that time. A symbol reference to an other unit
-           is still possible, because it's already loaded (PFV)
-           can't use in [] here, becuase unitid can be > 255 }
-         if (ttypesym(srsym).owner.unitid=0) then
+           loaded at that time. Only write the definition when the
+           symbol is the real owner of the definition (not a redefine) }
+         if (ttypesym(srsym).owner.unitid=0) and
+            ((ttypesym(srsym).restype.def.typesym=nil) or
+             (srsym=ttypesym(srsym).restype.def.typesym)) then
           tt.setdef(ttypesym(srsym).restype.def)
          else
           tt.setsym(srsym);
@@ -641,7 +642,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.46  2002-11-25 17:43:23  peter
+  Revision 1.47  2002-12-21 13:07:34  peter
+    * type redefine fix for tb0437
+
+  Revision 1.46  2002/11/25 17:43:23  peter
     * splitted defbase in defutil,symutil,defcmp
     * merged isconvertable and is_equal into compare_defs(_ext)
     * made operator search faster by walking the list only once

+ 11 - 4
compiler/symppu.pas

@@ -466,11 +466,15 @@ implementation
 
     procedure tcompilerppufile.puttype(const t:ttype);
       begin
-        { Don't write symbol references for the current unit
+        { Write symbol references when the symbol is a redefine,
+          but don't write symbol references for the current unit
           and for the system unit }
         if assigned(t.sym) and
-           (t.sym.owner.unitid<>0) and
-           (t.sym.owner.unitid<>1) then
+           (
+            (t.sym<>t.def.typesym) or
+            ((t.sym.owner.unitid<>0) and
+             (t.sym.owner.unitid<>1))
+           ) then
          begin
            putderef(nil);
            putderef(t.sym);
@@ -502,7 +506,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.17  2002-10-05 12:43:29  carl
+  Revision 1.18  2002-12-21 13:07:34  peter
+    * type redefine fix for tb0437
+
+  Revision 1.17  2002/10/05 12:43:29  carl
     * fixes for Delphi 6 compilation
      (warning : Some features do not work under Delphi)
 

+ 15 - 9
compiler/symtable.pas

@@ -500,14 +500,10 @@ implementation
         hp : tdef;
         hs : tsym;
       begin
-        { deref the interface definitions }
-        hp:=tdef(defindex.first);
-        while assigned(hp) do
-         begin
-           hp.deref;
-           hp:=tdef(hp.indexnext);
-         end;
-        { first deref the interface ttype symbols }
+        { first deref the interface ttype symbols. This is needs
+          to be done before the interface defs are derefed, because
+          the interface defs can contain references to the type symbols
+          which then already need to contain a resolved restype field (PFV) }
         hs:=tsym(symindex.first);
         while assigned(hs) do
          begin
@@ -515,6 +511,13 @@ implementation
              hs.deref;
            hs:=tsym(hs.indexnext);
          end;
+        { deref the interface definitions }
+        hp:=tdef(defindex.first);
+        while assigned(hp) do
+         begin
+           hp.deref;
+           hp:=tdef(hp.indexnext);
+         end;
         { deref the interface symbols }
         hs:=tsym(symindex.first);
         while assigned(hs) do
@@ -2338,7 +2341,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.85  2002-12-07 14:27:10  carl
+  Revision 1.86  2002-12-21 13:07:34  peter
+    * type redefine fix for tb0437
+
+  Revision 1.85  2002/12/07 14:27:10  carl
     * 3% memory optimization
     * changed some types
     + added type checking with different size for call node and for