mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-14 21:09:08 +02:00
* don't push/pop current_module.localsymtable when adding explicitly created
pointer/arraydefs, because these operations can have side-effects in case of helpers (will add/remove helpers, so popping after the insertion removed all helpers in the static symtable of the current unit) git-svn-id: trunk@21282 -
This commit is contained in:
parent
2ae09dc995
commit
f95925dd91
@ -6775,6 +6775,7 @@ implementation
|
||||
function getpointerdef(def: tdef): tpointerdef;
|
||||
var
|
||||
res: PHashSetItem;
|
||||
oldsymtablestack: tsymtablestack;
|
||||
begin
|
||||
if not assigned(current_module) then
|
||||
internalerror(2011071101);
|
||||
@ -6783,9 +6784,13 @@ implementation
|
||||
begin
|
||||
{ since these pointerdefs can be reused anywhere in the current
|
||||
unit, add them to the global/staticsymtable }
|
||||
symtablestack.push(current_module.localsymtable);
|
||||
oldsymtablestack:=symtablestack;
|
||||
{ do not simply push/pop current_module.localsymtable, because
|
||||
that can have side-effects (e.g., it removes helpers) }
|
||||
symtablestack:=nil;
|
||||
res^.Data:=tpointerdef.create(def);
|
||||
symtablestack.pop(current_module.localsymtable);
|
||||
current_module.localsymtable.insertdef(tdef(res^.Data));
|
||||
symtablestack:=oldsymtablestack;
|
||||
end;
|
||||
result:=tpointerdef(res^.Data);
|
||||
end;
|
||||
@ -6800,6 +6805,7 @@ implementation
|
||||
function getarraydef(def: tdef; elecount: asizeint): tarraydef;
|
||||
var
|
||||
res: PHashSetItem;
|
||||
oldsymtablestack: tsymtablestack;
|
||||
arrdesc: packed record
|
||||
def: tdef;
|
||||
elecount: asizeint;
|
||||
@ -6814,10 +6820,13 @@ implementation
|
||||
begin
|
||||
{ since these arraydef can be reused anywhere in the current
|
||||
unit, add them to the global/staticsymtable }
|
||||
oldsymtablestack:=symtablestack;
|
||||
symtablestack:=nil;
|
||||
symtablestack.push(current_module.localsymtable);
|
||||
res^.Data:=tarraydef.create(0,elecount-1,ptrsinttype);
|
||||
tarraydef(res^.Data).elementdef:=def;
|
||||
symtablestack.pop(current_module.localsymtable);
|
||||
current_module.localsymtable.insertdef(tdef(res^.Data));
|
||||
symtablestack:=oldsymtablestack;
|
||||
end;
|
||||
result:=tarraydef(res^.Data);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user