* use new TSym.EscapedRealName property when creating new symbols with the

same name as existing symbols

git-svn-id: trunk@47856 -
This commit is contained in:
Jonas Maebe 2020-12-27 13:18:53 +00:00
parent 5d51a788f7
commit 5e3e4437c4
2 changed files with 12 additions and 2 deletions

View File

@ -72,6 +72,7 @@ interface
TSymEntry = class(TFPHashObject)
private
FRealName : {$ifdef symansistr}TSymStr{$else}pshortstring{$endif};
function GetEscapedRealName: TSymStr;
function GetRealname: TSymStr;
procedure SetRealname(const ANewName: TSymStr);
public
@ -80,6 +81,7 @@ interface
Owner : TSymtable;
destructor destroy;override;
property RealName: TSymStr read GetRealName write SetRealName;
property EscapedRealName: TSymStr read GetEscapedRealName;
end;
{************************************************
@ -208,6 +210,14 @@ implementation
end;
function TSymEntry.GetEscapedRealName: TSymStr;
begin
result:=GetRealname;
if result=Name then
result:='$'+result;
end;
procedure TSymEntry.SetRealname(const ANewName:TSymStr);
begin
{$ifndef symansistr}

View File

@ -1257,7 +1257,7 @@ implementation
else
begin
symname:=sym.name;
symrealname:=sym.realname;
symrealname:=sym.EscapedRealName;
end;
result:=search_struct_member(trecorddef(nestedvarsdef),symname);
if not assigned(result) then
@ -1330,7 +1330,7 @@ implementation
sl:=tpropaccesslist.create;
sl.addsym(sl_load,pd.parentfpstruct);
sl.addsym(sl_subscript,tfieldvarsym(fsym));
aliassym:=cabsolutevarsym.create_ref(lsym.name,tfieldvarsym(fsym).vardef,sl);
aliassym:=cabsolutevarsym.create_ref(lsym.EscapedRealName,tfieldvarsym(fsym).vardef,sl);
{ hide the original variable (can't delete, because there
may be other loadnodes that reference it)
-- only for locals; hiding parameters changes the