From c743a3fd0db6831595783b46ee5cabdf1d2193b7 Mon Sep 17 00:00:00 2001 From: Greg Brail Date: Tue, 13 Aug 2024 16:03:46 -0700 Subject: [PATCH] Make interpreted mode consistently return integers too --- rhino/src/main/java/org/mozilla/javascript/Interpreter.java | 6 ++---- .../mozilla/javascript/tests/es6/NumericSeparatorTest.java | 2 +- tests/testsrc/test262.properties | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/rhino/src/main/java/org/mozilla/javascript/Interpreter.java b/rhino/src/main/java/org/mozilla/javascript/Interpreter.java index f476be5ce..004893b7c 100644 --- a/rhino/src/main/java/org/mozilla/javascript/Interpreter.java +++ b/rhino/src/main/java/org/mozilla/javascript/Interpreter.java @@ -2150,13 +2150,11 @@ public final class Interpreter extends Icode implements Evaluator { } case Icode_ZERO: ++stackTop; - stack[stackTop] = DBL_MRK; - sDbl[stackTop] = 0; + stack[stackTop] = Integer.valueOf(0); continue Loop; case Icode_ONE: ++stackTop; - stack[stackTop] = DBL_MRK; - sDbl[stackTop] = 1; + stack[stackTop] = Integer.valueOf(1); continue Loop; case Token.NULL: stack[++stackTop] = null; diff --git a/tests/src/test/java/org/mozilla/javascript/tests/es6/NumericSeparatorTest.java b/tests/src/test/java/org/mozilla/javascript/tests/es6/NumericSeparatorTest.java index b46cf9501..50b9a38fc 100644 --- a/tests/src/test/java/org/mozilla/javascript/tests/es6/NumericSeparatorTest.java +++ b/tests/src/test/java/org/mozilla/javascript/tests/es6/NumericSeparatorTest.java @@ -16,7 +16,7 @@ public class NumericSeparatorTest { /** Special Tokenizer test for numeric constant at end. */ @Test public void numericAtEndOneDigit() { - Utils.assertWithAllOptimizationLevelsES6(1.0, "1"); + Utils.assertWithAllOptimizationLevelsES6(1, "1"); } /** Special Tokenizer test for numeric constant at end. */ diff --git a/tests/testsrc/test262.properties b/tests/testsrc/test262.properties index 45f2a2116..729423feb 100644 --- a/tests/testsrc/test262.properties +++ b/tests/testsrc/test262.properties @@ -6187,7 +6187,6 @@ language/expressions/object 867/1169 (74.17%) accessor-name-literal-numeric-exponent.js {strict: [-1], non-strict: [-1]} accessor-name-literal-numeric-hex.js {strict: [-1], non-strict: [-1]} accessor-name-literal-numeric-octal.js {strict: [-1], non-strict: [-1]} - accessor-name-literal-numeric-zero.js computed-__proto__.js concise-generator.js cpn-obj-lit-computed-property-name-from-assignment-expression-coalesce.js