* 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); procedure tclassheader.gintfdoonintf(intf: tobjectdef; intfindex: longint);
var var
def: tdef; def: tdef;
hs,
mappedname: string; mappedname: string;
nextexist: pointer; nextexist: pointer;
implprocdef: tprocdef; implprocdef: tprocdef;
@ -1117,7 +1118,8 @@ implementation
implprocdef:=nil; implprocdef:=nil;
nextexist:=nil; nextexist:=nil;
repeat 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 if mappedname<>'' then
implprocdef:=gintfgetcprocdef(tprocdef(def),mappedname); implprocdef:=gintfgetcprocdef(tprocdef(def),mappedname);
until assigned(implprocdef) or not assigned(nextexist); 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; function parse_proc_head(aclass:tobjectdef;potype:tproctypeoption;var pd:tprocdef):boolean;
var var
hs : string;
orgsp,sp : stringid; orgsp,sp : stringid;
sym : tsym; sym : tsym;
srsym : tsym; srsym : tsym;
@ -690,9 +691,11 @@ implementation
if (i=-1) then if (i=-1) then
Message(parser_e_interface_id_expected); Message(parser_e_interface_id_expected);
consume(_ID); consume(_ID);
{ Create unique name <interface>.<method> }
hs:=sp+'.'+pattern;
consume(_EQUAL); consume(_EQUAL);
if (token=_ID) then if (token=_ID) then
aclass.implementedinterfaces.addmappings(i,sp,pattern); aclass.implementedinterfaces.addmappings(i,hs,pattern);
consume(_ID); consume(_ID);
result:=true; result:=true;
exit; exit;

View File

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