From eaeb6148874625b62b5bb6e8e75f802b88ea11d5 Mon Sep 17 00:00:00 2001 From: Sven/Sarah Barth Date: Mon, 17 Jan 2022 22:18:40 +0100 Subject: [PATCH] + provide a tsym based variant of ChangeOwnerAndName --- compiler/pgenutil.pas | 2 +- compiler/symtype.pas | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/compiler/pgenutil.pas b/compiler/pgenutil.pas index cb444833af..f618ffad9d 100644 --- a/compiler/pgenutil.pas +++ b/compiler/pgenutil.pas @@ -680,7 +680,7 @@ uses for i:=0 to unnamed_syms.count-1 do begin sym:=tsym(unnamed_syms[i]); - sym.ChangeOwnerAndName(owner.symlist,sym.realname); + sym.ChangeOwnerAndName(owner,sym.realname); end; unnamed_syms.clear; end; diff --git a/compiler/symtype.pas b/compiler/symtype.pas index 99585c2c62..3c10ba8fb5 100644 --- a/compiler/symtype.pas +++ b/compiler/symtype.pas @@ -143,6 +143,7 @@ interface procedure buildderef;virtual; procedure deref;virtual; procedure ChangeOwner(st:TSymtable); + procedure ChangeOwnerAndName(st:TSymtable;const aname:tsymstr); procedure IncRefCount; procedure IncRefCountBy(AValue : longint); procedure MaybeCreateRefList; @@ -687,6 +688,15 @@ implementation end; + procedure tsym.ChangeOwnerAndName(st:TSymtable;const aname:tsymstr); + begin + if assigned(owner) and owner.SymList.OwnsObjects then + owner.symlist.extract(self); + Owner:=st; + inherited ChangeOwnerAndName(Owner.SymList,aname); + end; + + {**************************************************************************** tpropaccesslist ****************************************************************************}