If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Broken Increment Behavior

RESOLVED INVALID

Status

()

Core
JavaScript Engine
RESOLVED INVALID
7 years ago
7 years ago

People

(Reporter: sstangl, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
While debugging bug 584651, I stumbled upon the following interesting behavior in the interpreter. Consider the following statements:

function a(x) { print(x) };

x = 5;
a(x++) => prints "5"
print(x) => prints "6"

Now consider, with the same definition of 'a':

x = Math.pow;
a(x++) => prints "NaN"
print(x) => prints "NaN"

The latter "a(x++)" should print out a native code object. We appear to be incrementing too early.
See ES5 11.3.1 Postfix Increment Operator step 3 and 6, or equivalent in previous editions:

3. Let oldValue be ToNumber(GetValue(lhs)).
. . .
6. Return oldValue.

/be
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.