mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 22:09:32 +02:00
* fixed tobjectdef.is_related() checks in case formal class definitions are
involved and the classes are not exactly equal (but one is a child of the other): we have to look up the real class definition first in those cases git-svn-id: trunk@20622 -
This commit is contained in:
parent
69ba57f4a7
commit
2e3605e999
@ -4979,6 +4979,7 @@ implementation
|
|||||||
{ true, if self inherits from d (or if they are equal) }
|
{ true, if self inherits from d (or if they are equal) }
|
||||||
function tobjectdef.is_related(d : tdef) : boolean;
|
function tobjectdef.is_related(d : tdef) : boolean;
|
||||||
var
|
var
|
||||||
|
realself,
|
||||||
hp : tobjectdef;
|
hp : tobjectdef;
|
||||||
begin
|
begin
|
||||||
if self=d then
|
if self=d then
|
||||||
@ -4992,17 +4993,21 @@ implementation
|
|||||||
is_related:=false;
|
is_related:=false;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
realself:=find_real_objcclass_definition(self,false);
|
||||||
|
d:=find_real_objcclass_definition(tobjectdef(d),false);
|
||||||
|
|
||||||
{ Objective-C protocols can use multiple inheritance }
|
{ Objective-C protocols can use multiple inheritance }
|
||||||
if (objecttype=odt_objcprotocol) then
|
if (realself.objecttype=odt_objcprotocol) then
|
||||||
begin
|
begin
|
||||||
is_related:=is_related_protocol(self,d);
|
is_related:=is_related_protocol(realself,d);
|
||||||
exit
|
exit
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ formally declared Objective-C classes match Objective-C classes with
|
{ formally declared Objective-C classes match Objective-C classes with
|
||||||
the same name }
|
the same name (still required even though we looked up the real
|
||||||
if (objecttype=odt_objcclass) and
|
definitions above, because these may be two different formal
|
||||||
|
declarations) }
|
||||||
|
if (realself.objecttype=odt_objcclass) and
|
||||||
(tobjectdef(d).objecttype=odt_objcclass) and
|
(tobjectdef(d).objecttype=odt_objcclass) and
|
||||||
((oo_is_formal in objectoptions) or
|
((oo_is_formal in objectoptions) or
|
||||||
(oo_is_formal in tobjectdef(d).objectoptions)) and
|
(oo_is_formal in tobjectdef(d).objectoptions)) and
|
||||||
@ -5012,7 +5017,7 @@ implementation
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
hp:=childof;
|
hp:=realself.childof;
|
||||||
while assigned(hp) do
|
while assigned(hp) do
|
||||||
begin
|
begin
|
||||||
if hp=d then
|
if hp=d then
|
||||||
|
Loading…
Reference in New Issue
Block a user