Closed Bug 514562 Opened 12 years ago Closed 12 years ago

ES5 strict mode: no assignments to eval

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jimb, Assigned: jimb)

References

(Blocks 1 open bug)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 2 obsolete files)

From ES5 Appendix C:

The identifier eval may not appear as the LeftHandSideExpression of an Assignment operator   (11.13) or of a PostfixExpression (11.3) or as the UnaryExpression operated upon by a Prefix   Increment (11.4.4) or a Prefix Decrement (11.4.5) operator.
Assignee: general → jim
Attachment #404929 - Flags: review?
Attachment #404929 - Flags: review? → review?(sayrer)
Duplicate of this bug: 514564
Fold in 'arguments' case.  Although the two are phrased differently in the standard, if one accounts for the erratum on this topic they end up being equivalent.

----

The ES5 spec requires that a TypeError be raised when an assignment to
"arguments" is evaluated in strict function code.  That is, the spec
requires the code:

    function f(x) { 'use strict'; if (x) arguments=1; }
    f(false);

to run without error.

Conversation on es5-discuss determined that this is an error in the
spec, noted in one of the meetings, that never got fixed in the text.

Raising a syntax error at compile time is the proper behavior.
Attachment #404929 - Attachment is obsolete: true
Attachment #405882 - Flags: review?(sayrer)
Attachment #404929 - Flags: review?(sayrer)
Now, with tests.
Attachment #405882 - Attachment is obsolete: true
Attachment #412436 - Flags: review?(mrbkap)
Attachment #405882 - Flags: review?(sayrer)
Attachment #412436 - Flags: review?(mrbkap) → review+
http://hg.mozilla.org/tracemonkey/rev/10046964146a
Status: NEW → ASSIGNED
Whiteboard: fixed-in-tracemonkey
Flags: in-testsuite+
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.