* fixed interface name mapping

git-svn-id: trunk@1443 -
This commit is contained in:
peter 2005-10-17 16:02:44 +00:00
parent 6e60c8a92b
commit 59a26e4f68
3 changed files with 14 additions and 9 deletions

View File

@ -1105,6 +1105,7 @@ implementation
procedure tclassheader.gintfdoonintf(intf: tobjectdef; intfindex: longint);
var
def: tdef;
hs,
mappedname: string;
nextexist: pointer;
implprocdef: tprocdef;
@ -1117,7 +1118,8 @@ implementation
implprocdef:=nil;
nextexist:=nil;
repeat
mappedname:=_class.implementedinterfaces.getmappings(intfindex,tprocdef(def).procsym.name,nextexist);
hs:=intf.symtable.name^+'.'+tprocdef(def).procsym.name;
mappedname:=_class.implementedinterfaces.getmappings(intfindex,hs,nextexist);
if mappedname<>'' then
implprocdef:=gintfgetcprocdef(tprocdef(def),mappedname);
until assigned(implprocdef) or not assigned(nextexist);

View File

@ -635,6 +635,7 @@ implementation
function parse_proc_head(aclass:tobjectdef;potype:tproctypeoption;var pd:tprocdef):boolean;
var
hs : string;
orgsp,sp : stringid;
sym : tsym;
srsym : tsym;
@ -690,9 +691,11 @@ implementation
if (i=-1) then
Message(parser_e_interface_id_expected);
consume(_ID);
{ Create unique name <interface>.<method> }
hs:=sp+'.'+pattern;
consume(_EQUAL);
if (token=_ID) then
aclass.implementedinterfaces.addmappings(i,sp,pattern);
aclass.implementedinterfaces.addmappings(i,hs,pattern);
consume(_ID);
result:=true;
exit;

View File

@ -285,8 +285,8 @@ interface
procedure addintf_deref(const d:tderef;iofs:longint);
procedure clearmappings;
procedure addmappings(intfindex: longint; const name, newname: string);
function getmappings(intfindex: longint; const name: string; var nextexist: pointer): string;
procedure addmappings(intfindex: longint; const origname, newname: string);
function getmappings(intfindex: longint; const origname: string; var nextexist: pointer): string;
procedure addimplproc(intfindex: longint; procdef: tprocdef);
function implproccount(intfindex: longint): longint;
@ -5063,7 +5063,7 @@ implementation
constructor tnamemap.create(const aname, anewname: string);
begin
inherited createname(name);
inherited createname(aname);
newname:=stringdup(anewname);
end;
@ -5237,25 +5237,25 @@ implementation
end;
end;
procedure timplementedinterfaces.addmappings(intfindex: longint; const name, newname: string);
procedure timplementedinterfaces.addmappings(intfindex: longint; const origname, newname: string);
begin
checkindex(intfindex);
with timplintfentry(finterfaces.search(intfindex)) do
begin
if not assigned(namemappings) then
namemappings:=tdictionary.create;
namemappings.insert(tnamemap.create(name,newname));
namemappings.insert(tnamemap.create(origname,newname));
end;
end;
function timplementedinterfaces.getmappings(intfindex: longint; const name: string; var nextexist: pointer): string;
function timplementedinterfaces.getmappings(intfindex: longint; const origname: string; var nextexist: pointer): string;
begin
checkindex(intfindex);
if not assigned(nextexist) then
with timplintfentry(finterfaces.search(intfindex)) do
begin
if assigned(namemappings) then
nextexist:=namemappings.search(name)
nextexist:=namemappings.search(origname)
else
nextexist:=nil;
end;