mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-11 13:29:18 +02:00
* support @inherited <method> to get the methodpointer
of <method> in a parent class git-svn-id: trunk@2526 -
This commit is contained in:
parent
e92d4c87bd
commit
b967ae8307
@ -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);
|
||||
|
@ -215,6 +215,7 @@ interface
|
||||
nf_absolute,
|
||||
nf_is_self,
|
||||
nf_load_self_pointer,
|
||||
nf_inherited,
|
||||
|
||||
{ taddnode }
|
||||
nf_is_currency,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user