* Fix tbs/tb0540.

git-svn-id: trunk@7926 -
This commit is contained in:
daniel 2007-07-02 21:32:27 +00:00
parent e4524a0d26
commit 4ed25e3a78

View File

@ -128,7 +128,7 @@ interface
implementation implementation
uses uses
globtype,systems, globtype,systems,constexp,
cutils,verbose,globals, cutils,verbose,globals,
symconst,symbase,defutil,defcmp, symconst,symbase,defutil,defcmp,
nbas,nutils, nbas,nutils,
@ -719,15 +719,28 @@ implementation
{ maybe type conversion for the index value, but { maybe type conversion for the index value, but
do not convert enums,booleans,char do not convert enums,booleans,char
and do not convert range nodes } and do not convert range nodes }
if (right.nodetype<>rangen) and ( if ((right.nodetype<>rangen) and is_integer(right.resultdef)) or (left.resultdef.typ<>arraydef) then
((right.resultdef.typ<>enumdef) and case left.resultdef.typ of
not(is_char(right.resultdef) or is_widechar(right.resultdef)) and arraydef:
not(is_boolean(right.resultdef)) if ado_IsDynamicArray in Tarraydef(left.resultdef).arrayoptions then
) or {Convert indexes into dynamic arrays to aword.}
(left.resultdef.typ <> arraydef) inserttypeconv(right,uinttype)
) then else
begin {Convert array indexes to low_bound..high_bound.}
inserttypeconv(right,sinttype); inserttypeconv(right,Torddef.create(Torddef(sinttype).ordtype,
int64(Tarraydef(left.resultdef).lowrange),
int64(Tarraydef(left.resultdef).highrange)
));
stringdef:
if Tstringdef(left.resultdef).stringtype=st_shortstring then
{Convert shortstring indexes to 0..length.}
inserttypeconv(right,Torddef.create(u8bit,0,int64(Tstringdef(left.resultdef).len)))
else
{Convert indexes into dynamically allocated strings to aword.}
inserttypeconv(right,uinttype);
else
{Others, i.e. pointer indexes to aint.}
inserttypeconv(right,sinttype);
end; end;
case left.resultdef.typ of case left.resultdef.typ of