Forráskód Böngészése

* don't push/pop the unit/program's static symtable on/off the symtable stack
before parsing the main begin/end, because that symtable is already on the
symtable stack at that point

git-svn-id: trunk@14233 -

Jonas Maebe 15 éve
szülő
commit
9d5b597105
1 módosított fájl, 7 hozzáadás és 3 törlés
  1. 7 3
      compiler/psub.pas

+ 7 - 3
compiler/psub.pas

@@ -1182,8 +1182,11 @@ implementation
         if procdef.parast.symtablelevel>=normal_function_level then
           symtablestack.push(procdef.parast);
 
-        { insert localsymtable }
-        symtablestack.push(procdef.localst);
+        { insert localsymtable, except for the main procedure
+          (in that case the localst is the unit's static symtable,
+           which is already on the stack) }
+        if procdef.localst.symtablelevel>=normal_function_level then
+          symtablestack.push(procdef.localst);
       end;
 
 
@@ -1192,7 +1195,8 @@ implementation
         _class : tobjectdef;
       begin
         { remove localsymtable }
-        symtablestack.pop(procdef.localst);
+        if procdef.localst.symtablelevel>=normal_function_level then
+          symtablestack.pop(procdef.localst);
 
         { remove parasymtable }
         if procdef.parast.symtablelevel>=normal_function_level then