Quellcode durchsuchen

* fixed bugs in r33737: that revision was supposed to only move
code from one unit to another, but in splitting some methods
I made a couple of mistakes :/ (causing global variables to be
initialised three times)

git-svn-id: trunk@35461 -

Jonas Maebe vor 8 Jahren
Ursprung
Commit
cadf177a93
2 geänderte Dateien mit 5 neuen und 8 gelöschten Zeilen
  1. 4 3
      compiler/hlcgobj.pas
  2. 1 5
      compiler/ngenutil.pas

+ 4 - 3
compiler/hlcgobj.pas

@@ -4537,9 +4537,10 @@ implementation
     begin
       { initialize register variables }
       case current_procinfo.procdef.proctypeoption of
-         potype_unitinit:
-           TSymtable(current_module.localsymtable).SymList.ForEachCall(@initialize_regvars,list);
-         potype_proginit:
+         { global regvars are only initialised in unitinitialize, and only
+           finalized in unitfinalize }
+         potype_unitfinalize: ;
+         else
            TSymtable(current_module.localsymtable).SymList.ForEachCall(@initialize_regvars,list);
       end;
 

+ 1 - 5
compiler/ngenutil.pas

@@ -420,15 +420,11 @@ implementation
              if assigned(current_module.globalsymtable) then
                TSymtable(current_module.globalsymtable).SymList.ForEachCall(@sym_maybe_initialize,@stat);
              TSymtable(current_module.localsymtable).SymList.ForEachCall(@sym_maybe_initialize,@stat);
-             TSymtable(current_module.localsymtable).SymList.ForEachCall(@sym_maybe_initialize,@stat);
            end;
          { units have seperate code for initilization and finalization }
          potype_unitfinalize: ;
          { program init/final is generated in separate procedure }
-         potype_proginit:
-           begin
-             TSymtable(current_module.localsymtable).SymList.ForEachCall(@sym_maybe_initialize,@stat);
-           end;
+         potype_proginit: ;
          else
            current_procinfo.procdef.localst.SymList.ForEachCall(@sym_maybe_initialize,@stat);
       end;