mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 18:47:52 +02:00
+ TSymtablestack.getcopyuntil() method that creates a copy of a
symtablestack up to and including a particular symtable git-svn-id: branches/jvmbackend@18582 -
This commit is contained in:
parent
e9e72e6de0
commit
1bc846dd3c
@ -133,6 +133,7 @@ interface
|
||||
procedure push(st:TSymtable); virtual;
|
||||
procedure pop(st:TSymtable); virtual;
|
||||
function top:TSymtable;
|
||||
function getcopyuntil(finalst: TSymtable): TSymtablestack;
|
||||
end;
|
||||
|
||||
|
||||
@ -430,6 +431,30 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function addstitemreverse(st: TSymtablestack; finalst: tsymtable; curitem: psymtablestackitem): boolean;
|
||||
begin
|
||||
if not assigned(curitem) then
|
||||
begin
|
||||
result:=true;
|
||||
exit;
|
||||
end;
|
||||
if addstitemreverse(st,finalst,curitem^.next) then
|
||||
begin
|
||||
st.push(curitem^.symtable);
|
||||
result:=curitem^.symtable<>finalst
|
||||
end
|
||||
else
|
||||
result:=false
|
||||
end;
|
||||
|
||||
|
||||
function TSymtablestack.getcopyuntil(finalst: TSymtable): TSymtablestack;
|
||||
begin
|
||||
result:=TSymtablestack.create;
|
||||
addstitemreverse(result,finalst,stack);
|
||||
end;
|
||||
|
||||
|
||||
{$ifdef MEMDEBUG}
|
||||
initialization
|
||||
memrealnames:=TMemDebug.create('Realnames');
|
||||
|
Loading…
Reference in New Issue
Block a user