mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-20 11:29:26 +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;
|
function getpointerdef(def: tdef): tpointerdef;
|
||||||
var
|
var
|
||||||
res: PHashSetItem;
|
res: PHashSetItem;
|
||||||
|
oldsymtablestack: tsymtablestack;
|
||||||
begin
|
begin
|
||||||
if not assigned(current_module) then
|
if not assigned(current_module) then
|
||||||
internalerror(2011071101);
|
internalerror(2011071101);
|
||||||
@ -6783,9 +6784,13 @@ implementation
|
|||||||
begin
|
begin
|
||||||
{ since these pointerdefs can be reused anywhere in the current
|
{ since these pointerdefs can be reused anywhere in the current
|
||||||
unit, add them to the global/staticsymtable }
|
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);
|
res^.Data:=tpointerdef.create(def);
|
||||||
symtablestack.pop(current_module.localsymtable);
|
current_module.localsymtable.insertdef(tdef(res^.Data));
|
||||||
|
symtablestack:=oldsymtablestack;
|
||||||
end;
|
end;
|
||||||
result:=tpointerdef(res^.Data);
|
result:=tpointerdef(res^.Data);
|
||||||
end;
|
end;
|
||||||
@ -6800,6 +6805,7 @@ implementation
|
|||||||
function getarraydef(def: tdef; elecount: asizeint): tarraydef;
|
function getarraydef(def: tdef; elecount: asizeint): tarraydef;
|
||||||
var
|
var
|
||||||
res: PHashSetItem;
|
res: PHashSetItem;
|
||||||
|
oldsymtablestack: tsymtablestack;
|
||||||
arrdesc: packed record
|
arrdesc: packed record
|
||||||
def: tdef;
|
def: tdef;
|
||||||
elecount: asizeint;
|
elecount: asizeint;
|
||||||
@ -6814,10 +6820,13 @@ implementation
|
|||||||
begin
|
begin
|
||||||
{ since these arraydef can be reused anywhere in the current
|
{ since these arraydef can be reused anywhere in the current
|
||||||
unit, add them to the global/staticsymtable }
|
unit, add them to the global/staticsymtable }
|
||||||
|
oldsymtablestack:=symtablestack;
|
||||||
|
symtablestack:=nil;
|
||||||
symtablestack.push(current_module.localsymtable);
|
symtablestack.push(current_module.localsymtable);
|
||||||
res^.Data:=tarraydef.create(0,elecount-1,ptrsinttype);
|
res^.Data:=tarraydef.create(0,elecount-1,ptrsinttype);
|
||||||
tarraydef(res^.Data).elementdef:=def;
|
tarraydef(res^.Data).elementdef:=def;
|
||||||
symtablestack.pop(current_module.localsymtable);
|
current_module.localsymtable.insertdef(tdef(res^.Data));
|
||||||
|
symtablestack:=oldsymtablestack;
|
||||||
end;
|
end;
|
||||||
result:=tarraydef(res^.Data);
|
result:=tarraydef(res^.Data);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user