* arrayconstructor -> openarray type conversions for element types

This commit is contained in:
peter 1999-08-16 23:23:38 +00:00
parent da93a8740e
commit 8e653af606
4 changed files with 47 additions and 8 deletions

View File

@ -98,6 +98,7 @@ implementation
var
b : byte;
hd1,hd2 : pdef;
hct : tconverttype;
begin
{ safety check }
if not(assigned(def_from) and assigned(def_to)) then
@ -244,6 +245,25 @@ implementation
else
begin
case def_from^.deftype of
arraydef :
begin
{ array constructor -> open array }
if is_open_array(def_to) and
is_array_constructor(def_from) then
begin
if is_equal(parraydef(def_to)^.definition,parraydef(def_from)^.definition) then
begin
doconv:=tc_equal;
b:=1;
end
else
if isconvertable(parraydef(def_to)^.definition,parraydef(def_from)^.definition,hct,nothingn,false)<>0 then
begin
doconv:=hct;
b:=2;
end;
end;
end;
pointerdef :
begin
if is_zero_based_array(def_to) and
@ -675,7 +695,10 @@ implementation
end.
{
$Log$
Revision 1.36 1999-08-06 12:49:36 jonas
Revision 1.37 1999-08-16 23:23:38 peter
* arrayconstructor -> openarray type conversions for element types
Revision 1.36 1999/08/06 12:49:36 jonas
* vo_fpuregable is now also removed in make_not_regable
Revision 1.35 1999/08/05 21:50:35 peter

View File

@ -252,7 +252,10 @@ implementation
p^.left^.cargs:=true;
end
else
p^.left^.novariaallowed:=true;
begin
p^.left^.novariaallowed:=true;
p^.left^.constructdef:=parraydef(defcoll^.data)^.definition;
end;
old_array_constructor:=allow_array_constructor;
allow_array_constructor:=true;
firstpass(p^.left);
@ -1203,7 +1206,10 @@ implementation
end.
{
$Log$
Revision 1.59 1999-08-13 21:33:16 peter
Revision 1.60 1999-08-16 23:23:39 peter
* arrayconstructor -> openarray type conversions for element types
Revision 1.59 1999/08/13 21:33:16 peter
* support for array constructors extended and more error checking
Revision 1.58 1999/08/12 14:34:28 peter

View File

@ -380,7 +380,7 @@ implementation
exit;
end;
{ only pass left tree, right tree contains next construct if any }
pd:=nil;
pd:=p^.constructdef;
len:=0;
varia:=false;
if assigned(p^.left) then
@ -430,8 +430,12 @@ implementation
if ((p^.novariaallowed) or (not varia)) and
(not is_equal(pd,hp^.left^.resulttype)) then
begin
{ if both should be equal try inserting a conversion }
if p^.novariaallowed then
CGMessage2(type_e_incompatible_types,hp^.left^.resulttype^.typename,pd^.typename);
begin
hp^.left:=gentypeconvnode(hp^.left,pd);
firstpass(hp^.left);
end;
varia:=true;
end;
end;
@ -487,7 +491,10 @@ implementation
end.
{
$Log$
Revision 1.40 1999-08-13 21:33:17 peter
Revision 1.41 1999-08-16 23:23:41 peter
* arrayconstructor -> openarray type conversions for element types
Revision 1.40 1999/08/13 21:33:17 peter
* support for array constructors extended and more error checking
Revision 1.39 1999/08/05 16:53:24 peter

View File

@ -231,7 +231,7 @@ unit tree;
labeln,goton : (labelnr : pasmlabel);
withn : (withsymtable : pwithsymtable;tablecount : longint;withreference:preference;islocal:boolean);
onn : (exceptsymtable : psymtable;excepttype : pobjectdef);
arrayconstructn : (cargs,cargswap,novariaallowed: boolean);
arrayconstructn : (cargs,cargswap,novariaallowed: boolean;constructdef:pdef);
end;
function gennode(t : ttreetyp;l,r : ptree) : ptree;
@ -1739,7 +1739,10 @@ unit tree;
end.
{
$Log$
Revision 1.88 1999-08-13 21:33:18 peter
Revision 1.89 1999-08-16 23:23:42 peter
* arrayconstructor -> openarray type conversions for element types
Revision 1.88 1999/08/13 21:33:18 peter
* support for array constructors extended and more error checking
Revision 1.87 1999/08/09 22:14:46 peter