Closed Bug 584957 Opened 14 years ago Closed 14 years ago

Broken Increment Behavior

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: sstangl, Unassigned)

References

Details

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
Closed: 14 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.