mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 03:19:29 +02:00
* fixes to valid_for_assign for properties
This commit is contained in:
parent
e652444594
commit
25d360a011
@ -731,11 +731,30 @@ implementation
|
|||||||
while assigned(hp) do
|
while assigned(hp) do
|
||||||
begin
|
begin
|
||||||
{ property allowed? calln has a property check itself }
|
{ property allowed? calln has a property check itself }
|
||||||
if not(valid_property in opts) and
|
if (nf_isproperty in hp.flags) then
|
||||||
(nf_isproperty in hp.flags) and
|
|
||||||
(hp.nodetype<>calln) then
|
|
||||||
begin
|
begin
|
||||||
|
if (valid_property in opts) then
|
||||||
|
valid_for_assign:=true
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
{ check return type }
|
||||||
|
case hp.resulttype.def.deftype of
|
||||||
|
pointerdef :
|
||||||
|
gotpointer:=true;
|
||||||
|
objectdef :
|
||||||
|
gotclass:=is_class_or_interface(hp.resulttype.def);
|
||||||
|
recorddef, { handle record like class it needs a subscription }
|
||||||
|
classrefdef :
|
||||||
|
gotclass:=true;
|
||||||
|
end;
|
||||||
|
{ 1. if it returns a pointer and we've found a deref,
|
||||||
|
2. if it returns a class or record and a subscription or with is found }
|
||||||
|
if (gotpointer and gotderef) or
|
||||||
|
(gotclass and (gotsubscript or gotwith)) then
|
||||||
|
valid_for_assign:=true
|
||||||
|
else
|
||||||
CGMessagePos(hp.fileinfo,type_e_argument_cant_be_assigned);
|
CGMessagePos(hp.fileinfo,type_e_argument_cant_be_assigned);
|
||||||
|
end;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
case hp.nodetype of
|
case hp.nodetype of
|
||||||
@ -789,8 +808,10 @@ implementation
|
|||||||
end;
|
end;
|
||||||
addrn :
|
addrn :
|
||||||
begin
|
begin
|
||||||
if not(gotderef) and
|
if gotderef or
|
||||||
not(nf_procvarload in hp.flags) then
|
(nf_procvarload in hp.flags) then
|
||||||
|
valid_for_assign:=true
|
||||||
|
else
|
||||||
CGMessagePos(hp.fileinfo,type_e_no_assign_to_addr);
|
CGMessagePos(hp.fileinfo,type_e_no_assign_to_addr);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -813,11 +834,9 @@ implementation
|
|||||||
gotclass:=true;
|
gotclass:=true;
|
||||||
end;
|
end;
|
||||||
{ 1. if it returns a pointer and we've found a deref,
|
{ 1. if it returns a pointer and we've found a deref,
|
||||||
2. if it returns a class or record and a subscription or with is found,
|
2. if it returns a class or record and a subscription or with is found }
|
||||||
3. property is allowed }
|
|
||||||
if (gotpointer and gotderef) or
|
if (gotpointer and gotderef) or
|
||||||
(gotclass and (gotsubscript or gotwith)) or
|
(gotclass and (gotsubscript or gotwith)) then
|
||||||
((nf_isproperty in hp.flags) and (valid_property in opts)) then
|
|
||||||
valid_for_assign:=true
|
valid_for_assign:=true
|
||||||
else
|
else
|
||||||
CGMessagePos(hp.fileinfo,type_e_argument_cant_be_assigned);
|
CGMessagePos(hp.fileinfo,type_e_argument_cant_be_assigned);
|
||||||
@ -918,7 +937,10 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.28 2001-06-04 11:48:02 peter
|
Revision 1.29 2001-06-04 18:04:36 peter
|
||||||
|
* fixes to valid_for_assign for properties
|
||||||
|
|
||||||
|
Revision 1.28 2001/06/04 11:48:02 peter
|
||||||
* better const to var checking
|
* better const to var checking
|
||||||
|
|
||||||
Revision 1.27 2001/05/18 22:57:08 peter
|
Revision 1.27 2001/05/18 22:57:08 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user