mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-07 06:46:47 +02:00
* implicitly convert constant string to stringdef if it is indexed
git-svn-id: trunk@1468 -
This commit is contained in:
parent
ea6dadb7be
commit
45fbeaad53
@ -229,14 +229,16 @@ implementation
|
|||||||
|
|
||||||
|
|
||||||
function tloadparentfpnode.det_resulttype:tnode;
|
function tloadparentfpnode.det_resulttype:tnode;
|
||||||
|
{$ifdef dummy}
|
||||||
var
|
var
|
||||||
currpi : tprocinfo;
|
currpi : tprocinfo;
|
||||||
hsym : tparavarsym;
|
hsym : tparavarsym;
|
||||||
|
{$endif dummy}
|
||||||
begin
|
begin
|
||||||
result:=nil;
|
result:=nil;
|
||||||
resulttype:=voidpointertype;
|
resulttype:=voidpointertype;
|
||||||
{
|
{$ifdef dummy}
|
||||||
currently parentfps are never loaded in registers (FK)
|
{ currently parentfps are never loaded in registers (FK) }
|
||||||
|
|
||||||
if (current_procinfo.procdef.parast.symtablelevel<>parentpd.parast.symtablelevel) then
|
if (current_procinfo.procdef.parast.symtablelevel<>parentpd.parast.symtablelevel) then
|
||||||
begin
|
begin
|
||||||
@ -253,7 +255,7 @@ implementation
|
|||||||
hsym.varregable:=vr_none;
|
hsym.varregable:=vr_none;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
}
|
{$endif dummy}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -638,6 +640,18 @@ implementation
|
|||||||
result:=nil;
|
result:=nil;
|
||||||
resulttypepass(left);
|
resulttypepass(left);
|
||||||
resulttypepass(right);
|
resulttypepass(right);
|
||||||
|
|
||||||
|
{ implicitly convert stringconstant to stringdef,
|
||||||
|
see tbs/tb0476.pp for a test }
|
||||||
|
if (left.nodetype=stringconstn) and
|
||||||
|
(tstringconstnode(left).st_type=st_conststring) then
|
||||||
|
begin
|
||||||
|
if tstringconstnode(left).len>255 then
|
||||||
|
inserttypeconv(left,cansistringtype)
|
||||||
|
else
|
||||||
|
inserttypeconv(left,cshortstringtype);
|
||||||
|
end;
|
||||||
|
|
||||||
{ In p[1] p is always valid, it is not possible to
|
{ In p[1] p is always valid, it is not possible to
|
||||||
declared a shortstring or normal array that has
|
declared a shortstring or normal array that has
|
||||||
undefined number of elements. Dynamic array and
|
undefined number of elements. Dynamic array and
|
||||||
|
Loading…
Reference in New Issue
Block a user