diff --git a/ts2panda/src/compiler.ts b/ts2panda/src/compiler.ts index 59cd1d776e4b8f12eee2ec123589307599e8cb86..fcc8536e3665dbe5dce8a7feb01cddd381d9a792 100644 --- a/ts2panda/src/compiler.ts +++ b/ts2panda/src/compiler.ts @@ -1210,7 +1210,7 @@ export class Compiler { // lvalue var = acc +/- 1 lref.setValue(); // acc = operand_old - pandaGen.toNumber(expr, operandReg); + pandaGen.toNumeric(expr, operandReg); pandaGen.freeTemps(operandReg); } diff --git a/ts2panda/src/pandagen.ts b/ts2panda/src/pandagen.ts index 0db314b6bdbce401e9834dfa2bf3396a3089eed1..65834994a59213dc421946a26277d79324a86a13 100644 --- a/ts2panda/src/pandagen.ts +++ b/ts2panda/src/pandagen.ts @@ -163,6 +163,7 @@ import { EcmaSub2dyn, EcmaSuspendgenerator, EcmaTonumber, + EcmaTonumeric, EcmaTypeofdyn, EcmaXor2dyn, Imm, @@ -1002,6 +1003,10 @@ export class PandaGen { this.add(node, new EcmaTonumber(arg)); } + toNumeric(node: ts.Node, arg: VReg) { + this.add(node, new EcmaTonumeric(arg)); + } + createGeneratorObj(node: ts.Node, funcObj: VReg) { this.add(node, new EcmaCreategeneratorobj(funcObj)); } diff --git a/ts2panda/tests/expression/cmpBinary.test.ts b/ts2panda/tests/expression/cmpBinary.test.ts index 55ad541245f8bf01c18086dab0ed541b8c0f5b3f..9d9c6dd63575ea48064238fea5bdf9c58eae26dc 100644 --- a/ts2panda/tests/expression/cmpBinary.test.ts +++ b/ts2panda/tests/expression/cmpBinary.test.ts @@ -33,7 +33,7 @@ import { EcmaStlettoglobalrecord, EcmaStricteqdyn, EcmaStrictnoteqdyn, - EcmaTonumber, + EcmaTonumeric, EcmaTryldglobalbyname, EcmaTrystglobalbyname, EcmaXor2dyn, @@ -295,7 +295,7 @@ describe("CmpBinaryOperators", function () { new StaDyn(lhs), new EcmaIncdyn(lhs), new EcmaTrystglobalbyname('x'), - new EcmaTonumber(variable), + new EcmaTonumeric(variable), new StaDyn(rhs), new EcmaTryldglobalbyname('x'), new EcmaTrystglobalbyname('x'), diff --git a/ts2panda/tests/expression/postfixOperations.test.ts b/ts2panda/tests/expression/postfixOperations.test.ts index 355649dc9c7d26a9db246a38ecbe9c54dead2e39..fdd7ad6d1c04cb478ee9290bd367c9eaddcc845a 100644 --- a/ts2panda/tests/expression/postfixOperations.test.ts +++ b/ts2panda/tests/expression/postfixOperations.test.ts @@ -22,7 +22,7 @@ import { EcmaIncdyn, EcmaReturnundefined, EcmaStlettoglobalrecord, - EcmaTonumber, + EcmaTonumeric, EcmaTryldglobalbyname, EcmaTrystglobalbyname, Imm, @@ -45,7 +45,7 @@ describe("PostfixOperationsTest", function () { new StaDyn(temp), new EcmaIncdyn(temp), new EcmaTrystglobalbyname('i'), - new EcmaTonumber(i), + new EcmaTonumeric(i), new EcmaReturnundefined() ]; expect(checkInstructions(insns, expected)).to.be.true; @@ -62,7 +62,7 @@ describe("PostfixOperationsTest", function () { new StaDyn(temp), new EcmaDecdyn(temp), new EcmaTrystglobalbyname('i'), - new EcmaTonumber(i), + new EcmaTonumeric(i), new EcmaReturnundefined() ]; expect(checkInstructions(insns, expected)).to.be.true; diff --git a/ts2panda/tests/lexenv.test.ts b/ts2panda/tests/lexenv.test.ts index c54daff6d00751d077d620e81c2db47364e8a815..a2180a6a1511f1bc8197ec3c4b22298636f52c9a 100644 --- a/ts2panda/tests/lexenv.test.ts +++ b/ts2panda/tests/lexenv.test.ts @@ -32,7 +32,7 @@ import { EcmaStlexvardyn, EcmaThrowconstassignment, EcmaThrowundefinedifhole, - EcmaTonumber, + EcmaTonumeric, EcmaTrystglobalbyname, Imm, IRNode, @@ -520,7 +520,7 @@ describe("lexenv-compile-testcase in lexenv.test.ts", function () { new EcmaIncdyn(new VReg()), new StaDyn(new VReg()), ...MicroStoreLexVar(1, 0), - new EcmaTonumber(new VReg()), // this is redundant load varialbe + new EcmaTonumeric(new VReg()), // this is redundant load varialbe ...MicroLoadLexVar(1, 0), new StaDyn(new VReg), ...MicroLoadLexVar(1, 1), diff --git a/ts2panda/tests/statements/for.test.ts b/ts2panda/tests/statements/for.test.ts index de8617947f7084aafdefbd1defb8b9dc550d820d..47bfce8d474592af88a61a45ad9f402f01c0e100 100644 --- a/ts2panda/tests/statements/for.test.ts +++ b/ts2panda/tests/statements/for.test.ts @@ -21,7 +21,7 @@ import { EcmaIncdyn, EcmaLessdyn, EcmaReturnundefined, - EcmaTonumber, + EcmaTonumeric, Imm, Jeqz, Jmp, @@ -228,7 +228,7 @@ describe("LoopWithLabelTests", function () { new StaDyn(j), new EcmaIncdyn(j), new StaDyn(j), - new EcmaTonumber(j), + new EcmaTonumeric(j), // jump to the loop header new Jmp(labelPre1), labelPost1, @@ -299,7 +299,7 @@ describe("LoopWithLabelTests", function () { new StaDyn(j), new EcmaIncdyn(j), new StaDyn(j), - new EcmaTonumber(j), + new EcmaTonumeric(j), // jump to the loop header new Jmp(labelPre1), labelPost1, diff --git a/ts2panda/tests/watch_expression/addWatch.test.ts b/ts2panda/tests/watch_expression/addWatch.test.ts index 7eacad422c8e907f5a3cd0b631a78cdf3e967afd..53ccee36959bc3f8a2227104b964e161407d4731 100644 --- a/ts2panda/tests/watch_expression/addWatch.test.ts +++ b/ts2panda/tests/watch_expression/addWatch.test.ts @@ -48,7 +48,7 @@ import { EcmaStricteqdyn, EcmaSuspendgenerator, EcmaThrowdyn, - EcmaTonumber, + EcmaTonumeric, EcmaTypeofdyn, FldaiDyn, Imm, @@ -661,7 +661,7 @@ describe("WatchExpressions", function () { new LdaStr('a'), new StaDyn(new VReg()), new EcmaCallargs2dyn(new VReg(), new VReg(), new VReg()), - new EcmaTonumber(new VReg()), + new EcmaTonumeric(new VReg()), new ReturnDyn() ];