Browse Source

compiler: use globalsymtable for units to store ansistring replacement def (fixes bug #0020529)

git-svn-id: trunk@19523 -
paul 13 years ago
parent
commit
110119e398
1 changed files with 8 additions and 2 deletions
  1. 8 2
      compiler/symdef.pas

+ 8 - 2
compiler/symdef.pas

@@ -861,6 +861,8 @@ implementation
       end;
       end;
 
 
     function getansistringdef:tstringdef; inline;
     function getansistringdef:tstringdef; inline;
+      var
+        symtable:tsymtable;
       begin
       begin
         { if codepage is explicitly defined in this mudule we need to return
         { if codepage is explicitly defined in this mudule we need to return
           a replacement for ansistring def }
           a replacement for ansistring def }
@@ -873,9 +875,13 @@ implementation
             if not assigned(current_module.ansistrdef) then
             if not assigned(current_module.ansistrdef) then
               begin
               begin
                 { if we did not create it yet we need to do this now }
                 { if we did not create it yet we need to do this now }
-                symtablestack.push(current_module.localsymtable);
+                if current_module.is_unit then
+                  symtable:=current_module.globalsymtable
+                else
+                  symtable:=current_module.localsymtable;
+                symtablestack.push(symtable);
                 current_module.ansistrdef:=tstringdef.createansi(current_settings.sourcecodepage);
                 current_module.ansistrdef:=tstringdef.createansi(current_settings.sourcecodepage);
-                symtablestack.pop(current_module.localsymtable);
+                symtablestack.pop(symtable);
               end;
               end;
             result:=tstringdef(current_module.ansistrdef);
             result:=tstringdef(current_module.ansistrdef);
           end
           end