mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 18:09:30 +02:00
* Fix tbs/tb0540.
git-svn-id: trunk@7926 -
This commit is contained in:
parent
e4524a0d26
commit
4ed25e3a78
@ -128,7 +128,7 @@ interface
|
||||
implementation
|
||||
|
||||
uses
|
||||
globtype,systems,
|
||||
globtype,systems,constexp,
|
||||
cutils,verbose,globals,
|
||||
symconst,symbase,defutil,defcmp,
|
||||
nbas,nutils,
|
||||
@ -719,15 +719,28 @@ implementation
|
||||
{ maybe type conversion for the index value, but
|
||||
do not convert enums,booleans,char
|
||||
and do not convert range nodes }
|
||||
if (right.nodetype<>rangen) and (
|
||||
((right.resultdef.typ<>enumdef) and
|
||||
not(is_char(right.resultdef) or is_widechar(right.resultdef)) and
|
||||
not(is_boolean(right.resultdef))
|
||||
) or
|
||||
(left.resultdef.typ <> arraydef)
|
||||
) then
|
||||
begin
|
||||
inserttypeconv(right,sinttype);
|
||||
if ((right.nodetype<>rangen) and is_integer(right.resultdef)) or (left.resultdef.typ<>arraydef) then
|
||||
case left.resultdef.typ of
|
||||
arraydef:
|
||||
if ado_IsDynamicArray in Tarraydef(left.resultdef).arrayoptions then
|
||||
{Convert indexes into dynamic arrays to aword.}
|
||||
inserttypeconv(right,uinttype)
|
||||
else
|
||||
{Convert array indexes to low_bound..high_bound.}
|
||||
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;
|
||||
|
||||
case left.resultdef.typ of
|
||||
|
Loading…
Reference in New Issue
Block a user