mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 05:49:12 +02:00
* having overloads is the same as overload directive for hiding of
parent methods. This is required becuase it can be possible that a method will then hide a method in the parent that an overloaded method requires. See webbug tw2185
This commit is contained in:
parent
3a419bde8a
commit
b9665f560b
@ -565,6 +565,7 @@ implementation
|
|||||||
pd : tprocdef;
|
pd : tprocdef;
|
||||||
i : cardinal;
|
i : cardinal;
|
||||||
is_visible,
|
is_visible,
|
||||||
|
hasoverloads,
|
||||||
pdoverload : boolean;
|
pdoverload : boolean;
|
||||||
begin
|
begin
|
||||||
{ put only sub routines into the VMT, and routines
|
{ put only sub routines into the VMT, and routines
|
||||||
@ -591,6 +592,7 @@ implementation
|
|||||||
if (_speed=symcoll^.speedvalue) and
|
if (_speed=symcoll^.speedvalue) and
|
||||||
(_name=symcoll^.name^) then
|
(_name=symcoll^.name^) then
|
||||||
begin
|
begin
|
||||||
|
hasoverloads:=(Tprocsym(sym).procdef_count>1);
|
||||||
{ walk through all defs of the symbol }
|
{ walk through all defs of the symbol }
|
||||||
for i:=1 to Tprocsym(sym).procdef_count do
|
for i:=1 to Tprocsym(sym).procdef_count do
|
||||||
begin
|
begin
|
||||||
@ -612,12 +614,12 @@ implementation
|
|||||||
begin
|
begin
|
||||||
{ if the current definition has no virtual then hide the
|
{ if the current definition has no virtual then hide the
|
||||||
old virtual if the new definition has the same arguments or
|
old virtual if the new definition has the same arguments or
|
||||||
has no overload directive }
|
when it has no overload directive and no overloads }
|
||||||
if not(po_virtualmethod in pd.procoptions) then
|
if not(po_virtualmethod in pd.procoptions) then
|
||||||
begin
|
begin
|
||||||
if (not pdoverload or
|
if tstoredsym(procdefcoll^.data.procsym).is_visible_for_object(pd._class) and
|
||||||
equal_paras(procdefcoll^.data.para,pd.para,cp_value_equal_const,false)) and
|
(not(pdoverload or hasoverloads) or
|
||||||
(tstoredsym(procdefcoll^.data.procsym).is_visible_for_object(pd._class)) then
|
equal_paras(procdefcoll^.data.para,pd.para,cp_value_equal_const,false)) then
|
||||||
begin
|
begin
|
||||||
if is_visible then
|
if is_visible then
|
||||||
procdefcoll^.hidden:=true;
|
procdefcoll^.hidden:=true;
|
||||||
@ -634,7 +636,7 @@ implementation
|
|||||||
not(po_overridingmethod in pd.procoptions) then
|
not(po_overridingmethod in pd.procoptions) then
|
||||||
begin
|
begin
|
||||||
{ we start a new virtual tree, hide the old }
|
{ we start a new virtual tree, hide the old }
|
||||||
if (not pdoverload or
|
if (not(pdoverload or hasoverloads) or
|
||||||
equal_paras(procdefcoll^.data.para,pd.para,cp_value_equal_const,false)) and
|
equal_paras(procdefcoll^.data.para,pd.para,cp_value_equal_const,false)) and
|
||||||
(tstoredsym(procdefcoll^.data.procsym).is_visible_for_object(pd._class)) then
|
(tstoredsym(procdefcoll^.data.procsym).is_visible_for_object(pd._class)) then
|
||||||
begin
|
begin
|
||||||
@ -704,7 +706,7 @@ implementation
|
|||||||
{ the new definition is virtual and the old static, we hide the old one
|
{ the new definition is virtual and the old static, we hide the old one
|
||||||
if the new defintion has not the overload directive }
|
if the new defintion has not the overload directive }
|
||||||
if is_visible and
|
if is_visible and
|
||||||
((not pdoverload) or
|
((not(pdoverload or hasoverloads)) or
|
||||||
equal_paras(procdefcoll^.data.para,pd.para,cp_value_equal_const,false)) then
|
equal_paras(procdefcoll^.data.para,pd.para,cp_value_equal_const,false)) then
|
||||||
procdefcoll^.hidden:=true;
|
procdefcoll^.hidden:=true;
|
||||||
end;
|
end;
|
||||||
@ -1317,7 +1319,13 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.32 2002-10-19 15:09:24 peter
|
Revision 1.33 2002-10-20 15:33:36 peter
|
||||||
|
* having overloads is the same as overload directive for hiding of
|
||||||
|
parent methods. This is required becuase it can be possible that a
|
||||||
|
method will then hide a method in the parent that an overloaded
|
||||||
|
method requires. See webbug tw2185
|
||||||
|
|
||||||
|
Revision 1.32 2002/10/19 15:09:24 peter
|
||||||
+ tobjectdef.members_need_inittable that is used to generate only the
|
+ tobjectdef.members_need_inittable that is used to generate only the
|
||||||
inittable when it is really used. This saves a lot of useless calls
|
inittable when it is really used. This saves a lot of useless calls
|
||||||
to fpc_finalize when destroying classes
|
to fpc_finalize when destroying classes
|
||||||
|
Loading…
Reference in New Issue
Block a user