* move check for unused object constructor result to blocknode

This commit is contained in:
peter 2003-10-29 20:34:20 +00:00
parent 003ea697c0
commit fae3eaf83d
2 changed files with 14 additions and 12 deletions

View File

@ -351,7 +351,10 @@ implementation
not(cs_extsyntax in aktmoduleswitches) and
(hp.left.nodetype=calln) and
not(is_void(hp.left.resulttype.def)) and
not(nf_return_value_used in tcallnode(hp.left).flags) then
not(nf_return_value_used in tcallnode(hp.left).flags) and
not((tcallnode(hp.left).procdefinition.proctypeoption=potype_constructor) and
assigned(tprocdef(tcallnode(hp.left).procdefinition)._class) and
is_object(tprocdef(tcallnode(hp.left).procdefinition)._class)) then
CGMessagePos(hp.left.fileinfo,cg_e_illegal_expression);
{ the resulttype of the block is the last type that is
returned. Normally this is a voidtype. But when the
@ -845,7 +848,10 @@ begin
end.
{
$Log$
Revision 1.69 2003-10-23 14:44:07 peter
Revision 1.70 2003-10-29 20:34:20 peter
* move check for unused object constructor result to blocknode
Revision 1.69 2003/10/23 14:44:07 peter
* splitted buildderef and buildderefimpl to fix interface crc
calculation

View File

@ -982,15 +982,11 @@ implementation
continuen,labeln,blockn,exitn]) then
Message(cg_e_illegal_expression);
{ specify that we don't use the value returned by the call
it is used for :
{ Specify that we don't use the value returned by the call.
This is used for :
- dispose of temp stack space
- dispose on FPU stack
Object constructor results are ignored }
if (p.nodetype=calln) and
not((tcallnode(p).procdefinition.proctypeoption=potype_constructor) and
assigned(tprocdef(tcallnode(p).procdefinition)._class) and
is_object(tprocdef(tcallnode(p).procdefinition)._class)) then
- dispose on FPU stack }
if (p.nodetype=calln) then
exclude(p.flags,nf_return_value_used);
code:=p;
@ -1134,8 +1130,8 @@ implementation
end.
{
$Log$
Revision 1.118 2003-10-29 20:01:41 peter
* object constructor results are always used
Revision 1.119 2003-10-29 20:34:20 peter
* move check for unused object constructor result to blocknode
Revision 1.117 2003/10/29 15:40:20 peter
* support indexing and offset retrieval for locals