Browse Source

+ add a method to tdef to initialize the defid from within a constructor

git-svn-id: trunk@43624 -
svenbarth 5 years ago
parent
commit
80a4a01f12
1 changed files with 11 additions and 1 deletions
  1. 11 1
      compiler/symtype.pas

+ 11 - 1
compiler/symtype.pas

@@ -55,6 +55,9 @@ interface
         protected
         protected
          { whether this def is already registered in the unit's def list }
          { whether this def is already registered in the unit's def list }
          function registered : boolean;
          function registered : boolean;
+         { initialize the defid field; only call from a constructor as it threats
+           0 as an invalid value! }
+         procedure init_defid;
         public
         public
          typesym    : tsym;  { which type the definition was generated this def }
          typesym    : tsym;  { which type the definition was generated this def }
          { stabs debugging }
          { stabs debugging }
@@ -273,6 +276,13 @@ implementation
       end;
       end;
 
 
 
 
+    procedure tdef.init_defid;
+      begin
+        if defid=0 then
+          defid:=defid_not_registered;
+      end;
+
+
     constructor tdef.create(dt:tdeftyp);
     constructor tdef.create(dt:tdeftyp);
       begin
       begin
          inherited create;
          inherited create;
@@ -282,7 +292,7 @@ implementation
          defoptions:=[];
          defoptions:=[];
          dbg_state:=dbg_state_unused;
          dbg_state:=dbg_state_unused;
          stab_number:=0;
          stab_number:=0;
-         defid:=defid_not_registered;
+         init_defid;
       end;
       end;