* support @inherited <method> to get the methodpointer

of <method> in a parent class

git-svn-id: trunk@2526 -
This commit is contained in:
peter 2006-02-11 22:49:00 +00:00
parent e92d4c87bd
commit b967ae8307
3 changed files with 13 additions and 2 deletions

View File

@ -326,7 +326,8 @@ implementation
cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,hregister,href);
{ virtual method ? }
if (po_virtualmethod in procdef.procoptions) then
if (po_virtualmethod in procdef.procoptions) and
not(nf_inherited in flags) then
begin
{ load vmt pointer }
reference_reset_base(href,hregister,0);

View File

@ -215,6 +215,7 @@ interface
nf_absolute,
nf_is_self,
nf_load_self_pointer,
nf_inherited,
{ taddnode }
nf_is_currency,

View File

@ -892,6 +892,15 @@ implementation
p2:=cloadnode.create_procvar(sym,aprocdef,st);
if assigned(p1) then
begin
{ for loading methodpointer of an inherited function
we use self as instance and load the address of
the function directly and not through the vmt (PFV) }
if (cnf_inherited in callflags) then
begin
include(p2.flags,nf_inherited);
p1.free;
p1:=load_self_node;
end;
if (p1.nodetype<>typen) then
tloadnode(p2).set_mp(p1)
else
@ -2086,7 +2095,7 @@ implementation
Message(parser_e_methode_id_expected);
p1:=cerrornode.create;
end;
do_member_read(classh,false,srsym,p1,again,[cnf_inherited,cnf_anon_inherited]);
do_member_read(classh,getaddr,srsym,p1,again,[cnf_inherited,cnf_anon_inherited]);
end
else
begin