Closed Bug 1215341 Opened 10 years ago Closed 10 years ago

Make assignment to const throw runtime TypeError regardless of strictness

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: shu, Assigned: shu)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Per ES6.
Attached patch Update tests.Splinter Review
Attachment #8674624 - Flags: review?(jdemooij)
Assignee: nobody → shu
Status: NEW → ASSIGNED
Attachment #8674622 - Flags: review?(jdemooij) → review+
Comment on attachment 8674623 [details] [diff] [review] Make assignment to const errors runtime TypeErrors in the JITs. Review of attachment 8674623 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jit/MIR.h @@ +7277,4 @@ > { > + unsigned errorNumber_; > + > + MThrowRuntimeLexicalError(unsigned errorNumber) Nit: `explicit`
Attachment #8674623 - Flags: review?(jdemooij) → review+
Comment on attachment 8674624 [details] [diff] [review] Update tests. Review of attachment 8674624 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jit-test/tests/basic/constAssignError.js @@ +8,5 @@ > > +assertTypeError("(function() { const x = 3; (function() x++)(); return x })()"); > +assertTypeError("(function() { const x = 3; (function() x++)(); return x++ })()"); > +assertTypeError("(function() { const x = 2; (function() x++)(); return ++x })()"); > +assertTypeError("(function() { const x = 2; (function() x++)(); return x += 1 })()"); While you're fixing this test, would you mind changing (4 times) (function() x++) to (() => x++) No deprecated syntax and nice to have a test for assigning to consts in arrows.
Attachment #8674624 - Flags: review?(jdemooij) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: