mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 21:19:26 +02:00
pastojs: convert pascal ** to js **
This commit is contained in:
parent
3822465e2f
commit
d8a2f7f714
@ -9243,13 +9243,8 @@ begin
|
||||
C:=TJSBitwiseXOrExpression; // no logical xor in JS. bitwise works for boolean too
|
||||
end;
|
||||
eopPower:
|
||||
begin
|
||||
Call:=CreateCallExpression(El);
|
||||
Call.Expr:=CreatePrimitiveDotExpr('Math.pow',El);
|
||||
Call.AddArg(A);
|
||||
Call.AddArg(B);
|
||||
Result:=Call;
|
||||
end;
|
||||
// convert pascal ** to js **
|
||||
C:=TJSPowerExpression;
|
||||
else
|
||||
if C=nil then
|
||||
DoError(20161024191244,nBinaryOpcodeNotSupported,sBinaryOpcodeNotSupported,[OpcodeStrings[El.OpCode]],El);
|
||||
|
@ -1171,13 +1171,13 @@ end;
|
||||
procedure TTestExpressionConverter.TestBinaryPower;
|
||||
Var
|
||||
B : TBinaryExpr;
|
||||
E : TJSRelationalExpressionInstanceOf;
|
||||
E : TJSPowerExpression;
|
||||
|
||||
begin
|
||||
B:=CreateBinary(eopPower);
|
||||
B.left:=CreateIdent('a');
|
||||
B.Right:=CreateIdent('b');
|
||||
E:=TJSRelationalExpressionInstanceOf(TestBinaryExpression(B,TJSRelationalExpressionInstanceOf));
|
||||
E:=TJSPowerExpression(TestBinaryExpression(B,TJSPowerExpression));
|
||||
AssertIdentifier('Correct left literal for power',E.A,'a');
|
||||
AssertIdentifier('Correct right literal for power',E.B,'b');
|
||||
end;
|
||||
|
@ -7868,6 +7868,7 @@ begin
|
||||
' d:=-004.00E-00;',
|
||||
' d:=-005.00E-001;',
|
||||
' d:=10**3;',
|
||||
' d:=100*9**0.5;',
|
||||
' d:=10 mod 3;',
|
||||
' d:=10 div 3;',
|
||||
' d:=c;',
|
||||
@ -7942,7 +7943,8 @@ begin
|
||||
'$mod.d = 3.000E0;',
|
||||
'$mod.d = -4.00E-0;',
|
||||
'$mod.d = -5.00E-1;',
|
||||
'$mod.d = Math.pow(10, 3);',
|
||||
'$mod.d = 10 ** 3;',
|
||||
'$mod.d = 100 * (9 ** 0.5);',
|
||||
'$mod.d = 10 % 3;',
|
||||
'$mod.d = rtl.trunc(10 / 3);',
|
||||
'$mod.d = 1;',
|
||||
|
Loading…
Reference in New Issue
Block a user