pastojs: ord(integer)

git-svn-id: trunk@48237 -
This commit is contained in:
Mattias Gaertner 2021-01-20 21:22:07 +00:00
parent af5a6cd9d2
commit c32ef4af38
2 changed files with 15 additions and 1 deletions

View File

@ -13399,6 +13399,15 @@ begin
Result:=Add;
exit;
end
else if bt in btAllJSInteger then
begin
// ord(integer)
Result:=CheckOrdConstant(aResolver,Param);
if Result<>nil then exit;
// ord(integer) -> integer
Result:=ConvertExpression(Param,AContext);
exit;
end
else if bt=btContext then
begin
C:=ParamResolved.LoTypeEl.ClassType;

View File

@ -7182,7 +7182,9 @@ begin
'begin',
' i:=i2;',
' i:=default(TMyInt);',
' if i=i2 then ;']);
' if i=i2 then ;',
' i:=ord(i2);',
'']);
ConvertProgram;
CheckSource('TestIntegerRange',
LinesToStr([
@ -7203,6 +7205,7 @@ begin
'$mod.i = $mod.i2;',
'$mod.i = -1;',
'if ($mod.i === $mod.i2) ;',
'$mod.i = $mod.i2;',
'']));
end;
@ -7317,6 +7320,7 @@ begin
' i:=system.high(i);',
' i:=system.pred(i);',
' i:=system.succ(i);',
' i:=system.ord(i);',
'']);
ConvertProgram;
CheckResolverUnexpectedHints;
@ -7333,6 +7337,7 @@ begin
'$mod.i = 255;',
'$mod.i = $mod.i - 1;',
'$mod.i = $mod.i + 1;',
'$mod.i = $mod.i;',
'']));
end;