Skip to content

Commit

Permalink
Number uses global parseInt and parseFloat
Browse files Browse the repository at this point in the history
  • Loading branch information
tonygermano committed May 6, 2021
1 parent d9a223d commit e27d456
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 8 additions & 4 deletions src/org/mozilla/javascript/NativeNumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,14 @@ protected void fillConstructorProperties(IdFunctionObject ctor) {
addIdFunctionProperty(ctor, NUMBER_TAG, ConstructorId_isNaN, "isNaN", 1);
addIdFunctionProperty(ctor, NUMBER_TAG, ConstructorId_isInteger, "isInteger", 1);
addIdFunctionProperty(ctor, NUMBER_TAG, ConstructorId_isSafeInteger, "isSafeInteger", 1);
addIdFunctionProperty(ctor, NUMBER_TAG, ConstructorId_parseFloat, "parseFloat", 1);
addIdFunctionProperty(ctor, NUMBER_TAG, ConstructorId_parseInt, "parseInt", 1);
Object parseFloat = ScriptRuntime.getTopLevelProp(ctor, "parseFloat");
if (parseFloat instanceof IdFunctionObject) {
((IdFunctionObject) parseFloat).addAsProperty(ctor);
}
Object parseInt = ScriptRuntime.getTopLevelProp(ctor, "parseInt");
if (parseInt instanceof IdFunctionObject) {
((IdFunctionObject) parseInt).addAsProperty(ctor);
}

super.fillConstructorProperties(ctor);
}
Expand Down Expand Up @@ -371,8 +377,6 @@ protected int findPrototypeId(String s) {
ConstructorId_isNaN = -2,
ConstructorId_isInteger = -3,
ConstructorId_isSafeInteger = -4,
ConstructorId_parseFloat = -5,
ConstructorId_parseInt = -6,
Id_constructor = 1,
Id_toString = 2,
Id_toLocaleString = 3,
Expand Down
4 changes: 0 additions & 4 deletions testsrc/test262.properties
Original file line number Diff line number Diff line change
Expand Up @@ -656,10 +656,6 @@ built-ins/Number
! prototype/toExponential/undefined-fractiondigits.js
! prototype/toLocaleString/length.js
! prototype/toPrecision/nan.js
# Number.parseInt === parseInt and Number.parseFloat === parseFloat
# but they aren't in Rhino
! parseFloat.js
! parseInt.js

built-ins/Object
! assign/strings-and-symbol-order.js
Expand Down

0 comments on commit e27d456

Please sign in to comment.