Closed Bug 514576 Opened 14 years ago Closed 14 years ago
ES5 strict mode: no 'with' statements permitted in strict mode code
From ES5 Annex C: Strict mode code may not include a WithStatement. The occurrence of a WithStatement in such a context is an SyntaxError (12.10).
Hmm. Back in bug 322430, we decided that warnings about 'with' statements were misguided with JSOPTION_STRICT enabled. ES5 strict mode forbids 'with' statements. How should a unified strictness regime behave?
Sorry, my memory fails me, but can you remind me of the separate bit somewhere that indicates ES5 strict mode (a static property of JSScript, presumably a new bitfield). That plus JSOPTION_STRICT could enable the warning, whereas just JSOPTION_STRICT would not. Then you pick your poison with option-setting and/or "use strict". /be
Assignee: general → jim
Attachment #404910 - Flags: review?(mrbkap)
Comment on attachment 404910 [details] [diff] [review] Forbid 'with' statements in strict mode code. I like this patch so much, I'm going to give it 2 +s. However, I do have a nitpick: >+ return NULL; >+ } > pn = NewParseNode(PN_BINARY, tc); Please add a newline before this assignment.
(In reply to comment #4) > (From update of attachment 404910 [details] [diff] [review]) > I like this patch so much, I'm going to give it 2 +s. :) > However, I do have a > nitpick: > >+ return NULL; > >+ } > > pn = NewParseNode(PN_BINARY, tc); > > Please add a newline before this assignment. Fixed --- thanks!
Code unchanged; just added tests.
Attachment #406582 - Flags: review?(mrbkap) → review+
Revised tests per jorendorff's and waldo's comments.
Attachment #406582 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.