mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 15:29:14 +02:00
* move the check whether a subclassed type helper extends a suitable subtype of the parent's extended type to a nested procedure
git-svn-id: trunk@36936 -
This commit is contained in:
parent
d8ce141e2c
commit
eef06e9bc6
@ -721,6 +721,20 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure check_inheritance_class_helper(var def:tdef);
|
||||||
|
begin
|
||||||
|
if (def.typ<>errordef) and assigned(current_objectdef.childof) then
|
||||||
|
begin
|
||||||
|
if not is_class(current_objectdef.childof.extendeddef) then
|
||||||
|
Internalerror(2011021101);
|
||||||
|
if not def_is_related(def,current_objectdef.childof.extendeddef) then
|
||||||
|
begin
|
||||||
|
Message1(type_e_class_helper_must_extend_subclass,current_objectdef.childof.extendeddef.typename);
|
||||||
|
def:=generrordef;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
hdef: tdef;
|
hdef: tdef;
|
||||||
begin
|
begin
|
||||||
@ -753,13 +767,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
{ a class helper must extend the same class or a subclass
|
{ a class helper must extend the same class or a subclass
|
||||||
of the class extended by the parent class helper }
|
of the class extended by the parent class helper }
|
||||||
if assigned(current_objectdef.childof) then
|
check_inheritance_class_helper(hdef);
|
||||||
begin
|
|
||||||
if not is_class(current_objectdef.childof.extendeddef) then
|
|
||||||
Internalerror(2011021101);
|
|
||||||
if not def_is_related(hdef,current_objectdef.childof.extendeddef) then
|
|
||||||
Message1(type_e_class_helper_must_extend_subclass,current_objectdef.childof.extendeddef.typename);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
ht_record:
|
ht_record:
|
||||||
if (hdef.typ=objectdef) or
|
if (hdef.typ=objectdef) or
|
||||||
|
Loading…
Reference in New Issue
Block a user