Quellcode durchsuchen

+ proper support of type <id> = type <another id>;

florian vor 23 Jahren
Ursprung
Commit
1665fc6a60
3 geänderte Dateien mit 31 neuen und 8 gelöschten Zeilen
  1. 5 2
      compiler/defbase.pas
  2. 16 3
      compiler/pdecl.pas
  3. 10 3
      compiler/symconst.pas

+ 5 - 2
compiler/defbase.pas

@@ -1052,7 +1052,7 @@ implementation
 
          { both point to the same definition ? }
          if def1=def2 then
-           b:=true
+           b:=not((df_unique in def1.defoptions) or (df_unique in def2.defoptions))
          else
          { pointer with an equal definition are equal }
            if (def1.deftype=pointerdef) and (def2.deftype=pointerdef) then
@@ -1969,7 +1969,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.16  2002-10-05 12:43:24  carl
+  Revision 1.17  2002-10-06 12:25:04  florian
+    + proper support of type <id> = type <another id>;
+
+  Revision 1.16  2002/10/05 12:43:24  carl
     * fixes for Delphi 6 compilation
      (warning : Some features do not work under Delphi)
 

+ 16 - 3
compiler/pdecl.pas

@@ -388,7 +388,8 @@ implementation
          defpos,storetokenpos : tfileposinfo;
          old_block_type : tblock_type;
          ch       : tclassheader;
-         istyperenaming : boolean;
+         unique,istyperenaming : boolean;
+
       begin
          old_block_type:=block_type;
          block_type:=bt_type;
@@ -403,7 +404,12 @@ implementation
            consume(_EQUAL);
            { support 'ttype=type word' syntax }
            if token=_TYPE then
-            Consume(_TYPE);
+             begin
+                Consume(_TYPE);
+                unique:=true;
+             end
+           else
+             unique:=false;
            { is the type already defined? }
            searchsym(typename,sym,srsymtable);
            newtype:=nil;
@@ -456,6 +462,10 @@ implementation
             end;
            if assigned(tt.def) then
             begin
+              if unique then
+                include(tt.def.defoptions,df_unique)
+              else
+                exclude(tt.def.defoptions,df_unique);
               case tt.def.deftype of
                 pointerdef :
                   begin
@@ -617,7 +627,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.53  2002-08-25 19:25:19  peter
+  Revision 1.54  2002-10-06 12:25:05  florian
+    + proper support of type <id> = type <another id>;
+
+  Revision 1.53  2002/08/25 19:25:19  peter
     * sym.insert_in_data removed
     * symtable.insertvardata/insertconstdata added
     * removed insert_in_data call from symtable.insert, it needs to be

+ 10 - 3
compiler/symconst.pas

@@ -121,8 +121,12 @@ type
 
   { flags for a definition }
   tdefoption=(df_none,
-    df_has_inittable,           { init data has been generated }
-    df_has_rttitable            { rtti data has been generated }
+    { init data has been generated }
+    df_has_inittable,
+    { rtti data has been generated }
+    df_has_rttitable,
+    { unique type which is declared by <id> = type <another id>; }
+    df_unique
   );
   tdefoptions=set of tdefoption;
 
@@ -335,7 +339,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.34  2002-08-19 19:36:44  peter
+  Revision 1.35  2002-10-06 12:25:05  florian
+    + proper support of type <id> = type <another id>;
+
+  Revision 1.34  2002/08/19 19:36:44  peter
     * More fixes for cross unit inlining, all tnodes are now implemented
     * Moved pocall_internconst to po_internconst because it is not a
       calling type at all and it conflicted when inlining of these small