* array constructor fix

This commit is contained in:
peter 2001-04-05 21:03:08 +00:00
parent 6f8b934ce7
commit bdb7e3b875

View File

@ -547,8 +547,8 @@ implementation
function tarrayconstructornode.det_resulttype:tnode; function tarrayconstructornode.det_resulttype:tnode;
var var
htype : ttype; htype : ttype;
hp : tarrayconstructornode; hp : tarrayconstructornode;
len : longint; len : longint;
varia : boolean; varia : boolean;
begin begin
result:=nil; result:=nil;
@ -601,8 +601,11 @@ implementation
var var
thp, thp,
chp, chp,
hp : tarrayconstructornode; hp : tarrayconstructornode;
dovariant : boolean;
htype : ttype;
begin begin
dovariant:=(nf_forcevaria in flags) or parraydef(resulttype.def)^.isvariant;
result:=nil; result:=nil;
{ only pass left tree, right tree contains next construct if any } { only pass left tree, right tree contains next construct if any }
if assigned(left) then if assigned(left) then
@ -611,9 +614,8 @@ implementation
while assigned(hp) do while assigned(hp) do
begin begin
firstpass(hp.left); firstpass(hp.left);
set_varstate(hp.left,true);
{ Insert typeconvs for array of const } { Insert typeconvs for array of const }
if parraydef(resulttype.def)^.IsVariant then if dovariant then
begin begin
case hp.left.resulttype.def^.deftype of case hp.left.resulttype.def^.deftype of
enumdef : enumdef :
@ -661,6 +663,8 @@ implementation
if (nf_cargs in flags) and (not(nf_cargswap in flags)) then if (nf_cargs in flags) and (not(nf_cargswap in flags)) then
begin begin
chp:=nil; chp:=nil;
{ save resulttype }
htype:=resulttype;
{ we need a copy here, because self is destroyed } { we need a copy here, because self is destroyed }
{ by firstpass later } { by firstpass later }
hp:=tarrayconstructornode(getcopy); hp:=tarrayconstructornode(getcopy);
@ -675,6 +679,7 @@ implementation
include(chp.flags,nf_cargswap); include(chp.flags,nf_cargswap);
calcregisters(chp,0,0,0); calcregisters(chp,0,0,0);
chp.location.loc:=LOC_MEM; chp.location.loc:=LOC_MEM;
chp.resulttype:=htype;
result:=chp; result:=chp;
exit; exit;
end; end;
@ -732,7 +737,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.12 2001-04-04 22:42:40 peter Revision 1.13 2001-04-05 21:03:08 peter
* array constructor fix
Revision 1.12 2001/04/04 22:42:40 peter
* move constant folding into det_resulttype * move constant folding into det_resulttype
Revision 1.11 2001/04/02 21:20:31 peter Revision 1.11 2001/04/02 21:20:31 peter