mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 13:09:18 +02:00
* fixed web bug #1621 (write(typed_file,function_call) works again)
* allow write(typed_file,procvar_call) too (it was already allowed for text file writes)
This commit is contained in:
parent
05b3e02a17
commit
241f775056
@ -435,6 +435,15 @@ implementation
|
|||||||
found_error := true;
|
found_error := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ support writeln(procvar) }
|
||||||
|
if (para.left.resulttype.def.deftype=procvardef) then
|
||||||
|
begin
|
||||||
|
p1:=ccallnode.create(nil,nil,nil,nil);
|
||||||
|
tcallnode(p1).set_procvar(para.left);
|
||||||
|
resulttypepass(p1);
|
||||||
|
para.left:=p1;
|
||||||
|
end;
|
||||||
|
|
||||||
if not is_equal(para.left.resulttype.def,tfiledef(filepara.resulttype.def).typedfiletype.def) then
|
if not is_equal(para.left.resulttype.def,tfiledef(filepara.resulttype.def).typedfiletype.def) then
|
||||||
begin
|
begin
|
||||||
CGMessagePos(para.left.fileinfo,type_e_mismatch);
|
CGMessagePos(para.left.fileinfo,type_e_mismatch);
|
||||||
@ -458,6 +467,26 @@ implementation
|
|||||||
{ get next parameter }
|
{ get next parameter }
|
||||||
nextpara := tcallparanode(para.right);
|
nextpara := tcallparanode(para.right);
|
||||||
|
|
||||||
|
{ When we have a call, we have a problem: you can't pass the }
|
||||||
|
{ result of a call as a formal const parameter. Solution: }
|
||||||
|
{ assign the result to a temp and pass this temp as parameter }
|
||||||
|
{ This is not very efficient, but write(typedfile,x) is }
|
||||||
|
{ already slow by itself anyway (no buffering) (JM) }
|
||||||
|
if (para.left.nodetype = calln) then
|
||||||
|
begin
|
||||||
|
{ create temp for result }
|
||||||
|
temp := ctempcreatenode.create(para.left.resulttype,
|
||||||
|
para.left.resulttype.def.size,true);
|
||||||
|
newstatement.left := cstatementnode.create(nil,temp);
|
||||||
|
{ assign result to temp }
|
||||||
|
newstatement := tstatementnode(newstatement.left);
|
||||||
|
newstatement.left := cstatementnode.create(nil,
|
||||||
|
cassignmentnode.create(ctemprefnode.create(temp),
|
||||||
|
para.left));
|
||||||
|
newstatement := tstatementnode(newstatement.left);
|
||||||
|
{ replace (reused) paranode with temp }
|
||||||
|
para.left := ctemprefnode.create(temp);
|
||||||
|
end;
|
||||||
{ add fileparameter }
|
{ add fileparameter }
|
||||||
para.right := filepara.getcopy;
|
para.right := filepara.getcopy;
|
||||||
|
|
||||||
@ -468,6 +497,14 @@ implementation
|
|||||||
ccallnode.createintern(procprefix,para));
|
ccallnode.createintern(procprefix,para));
|
||||||
newstatement := tstatementnode(newstatement.left);
|
newstatement := tstatementnode(newstatement.left);
|
||||||
|
|
||||||
|
{ if we used a temp, free it }
|
||||||
|
if para.left.nodetype = temprefn then
|
||||||
|
begin
|
||||||
|
newstatement.left := cstatementnode.create(nil,
|
||||||
|
ctempdeletenode.create(temp));
|
||||||
|
newstatement := tstatementnode(newstatement.left);
|
||||||
|
end;
|
||||||
|
|
||||||
{ process next parameter }
|
{ process next parameter }
|
||||||
para := nextpara;
|
para := nextpara;
|
||||||
end;
|
end;
|
||||||
@ -2256,7 +2293,12 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.62 2001-09-30 16:16:28 jonas
|
Revision 1.63 2001-10-24 16:17:36 jonas
|
||||||
|
* fixed web bug 1621 (write(typed_file,function_call) works again)
|
||||||
|
* allow write(typed_file,procvar_call) too (it was already allowed for
|
||||||
|
text file writes)
|
||||||
|
|
||||||
|
Revision 1.62 2001/09/30 16:16:28 jonas
|
||||||
- removed unused units form uses-clause and unused local vars
|
- removed unused units form uses-clause and unused local vars
|
||||||
|
|
||||||
Revision 1.61 2001/09/24 16:09:55 jonas
|
Revision 1.61 2001/09/24 16:09:55 jonas
|
||||||
|
Loading…
Reference in New Issue
Block a user