diff options
author | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2011-04-10 19:20:48 +0000 |
---|---|---|
committer | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2011-04-10 19:20:48 +0000 |
commit | 160cc1e115eeb75638dce6effdd16b2bc810ddb4 (patch) | |
tree | b791a95695a7cf674e61a6153139c6f9c6c491fa /compiler/ncal.pas | |
parent | 3843727e74b31bbf2a34e7e3b89ee422269f770e (diff) | |
parent | 413a6aa6469e6c297780217a27ca91363c637944 (diff) | |
download | fpc-avr.tar.gz |
* rebase to trunk@17295avr
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/avr@17296 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/ncal.pas')
-rw-r--r-- | compiler/ncal.pas | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/compiler/ncal.pas b/compiler/ncal.pas index 097aa18b40..9d1bc440cb 100644 --- a/compiler/ncal.pas +++ b/compiler/ncal.pas @@ -201,6 +201,9 @@ interface function can_be_inlined: boolean; property nextpara : tnode read right write right; + { third is reused to store the parameter name (only while parsing + vardispatch calls, never in real node tree) and copy of 'high' + parameter tree when the parameter is an open array of managed type } property parametername : tnode read third write third; { returns whether the evaluation of this parameter involves a @@ -620,6 +623,8 @@ implementation old_array_constructor:=allow_array_constructor; allow_array_constructor:=true; typecheckpass(left); + if assigned(third) then + typecheckpass(third); allow_array_constructor:=old_array_constructor; if codegenerror then resultdef:=generrordef @@ -635,6 +640,8 @@ implementation if not assigned(left.resultdef) then get_paratype; firstpass(left); + if assigned(third) then + firstpass(third); expectloc:=left.expectloc; end; @@ -2492,6 +2499,7 @@ implementation varargspara, currpara : tparavarsym; hiddentree : tnode; + paradef : tdef; begin pt:=tcallparanode(left); oldppt:=pcallparanode(@left); @@ -2527,7 +2535,19 @@ implementation if not assigned(pt) or (i=0) then internalerror(200304081); { we need the information of the previous parameter } - hiddentree:=gen_high_tree(pt.left,tparavarsym(procdefinition.paras[i-1]).vardef); + paradef:=tparavarsym(procdefinition.paras[i-1]).vardef; + hiddentree:=gen_high_tree(pt.left,paradef); + { for open array of managed type, a copy of high parameter is + necessary to properly initialize before the call } + if is_open_array(paradef) and + (tparavarsym(procdefinition.paras[i-1]).varspez=vs_out) and + is_managed_type(tarraydef(paradef).elementdef) then + begin + typecheckpass(hiddentree); + {this eliminates double call to fpc_dynarray_high, if any} + maybe_load_in_temp(hiddentree); + oldppt^.third:=hiddentree.getcopy; + end; end else if vo_is_typinfo_para in currpara.varoptions then |