Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Issue 1033823002: [es6] emit error when for-in loop declarations are initialized in strict mode (Closed)

Created:
5 years, 9 months ago by caitp (gmail)
Modified:
5 years, 7 months ago
CC:
v8-dev
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[es6] emit error when for-in loop declarations are initialized in strict mode The ES6 grammar forbids the initialization of variable declarations in IterationStatements. This CL will report `for (var x = y in z)` as a SyntaxError in strict mode (as done in JSC). It is possible that this could break sites in sloppy mode, and so that change can wait. BUG= R= LOG=N Committed: https://crrev.com/1fb76f055a4a0d0a2f5e5d2784b0f070fc279b2b Cr-Commit-Position: refs/heads/master@{#27639}

Patch Set 1 #

Total comments: 6

Patch Set 2 : Update error message, add fixes for let decls #

Total comments: 2

Patch Set 3 : Add TODO #

Total comments: 6

Patch Set 4 : Rebase #

Patch Set 5 : delete decl_props #

Unified diffs Side-by-side diffs Delta from patch set Stats (+130 lines, -56 lines) Patch
M src/messages.js View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M src/parser.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M src/parser.cc View 1 2 3 4 7 chunks +40 lines, -17 lines 0 comments Download
M src/preparser.h View 1 2 3 4 2 chunks +1 line, -4 lines 0 comments Download
M src/preparser.cc View 1 2 3 4 5 chunks +29 lines, -17 lines 0 comments Download
A + test/message/for-in-let-loop-initializers-strict.js View 1 1 chunk +4 lines, -3 lines 0 comments Download
A test/message/for-in-let-loop-initializers-strict.out View 1 1 chunk +7 lines, -0 lines 0 comments Download
A + test/message/for-in-loop-initializers-strict.js View 1 chunk +4 lines, -3 lines 0 comments Download
A test/message/for-in-loop-initializers-strict.out View 1 1 chunk +7 lines, -0 lines 0 comments Download
A + test/message/for-of-let-loop-initializers.js View 1 1 chunk +4 lines, -3 lines 0 comments Download
A test/message/for-of-let-loop-initializers.out View 1 1 chunk +7 lines, -0 lines 0 comments Download
A + test/message/for-of-loop-initializers-sloppy.js View 1 chunk +5 lines, -4 lines 0 comments Download
A test/message/for-of-loop-initializers-sloppy.out View 1 chunk +7 lines, -0 lines 0 comments Download
A + test/message/for-of-loop-initializers-strict.js View 1 1 chunk +4 lines, -3 lines 0 comments Download
A test/message/for-of-loop-initializers-strict.out View 1 chunk +7 lines, -0 lines 0 comments Download

Messages

Total messages: 20 (4 generated)
caitp (gmail)
PTAL --- JavaScriptCore is doing a similar thing (emit the error only in strict mode ...
5 years, 9 months ago (2015-03-24 21:33:43 UTC) #1
caitp (gmail)
A nice follow-up to this would be improving the error message for multiple variable declarations ...
5 years, 9 months ago (2015-03-24 22:02:56 UTC) #2
arv (Not doing code reviews)
"For legacy compatibility, this change must not affects loppy mode" - This is not true. ...
5 years, 9 months ago (2015-03-25 09:07:59 UTC) #4
arv (Not doing code reviews)
https://codereview.chromium.org/1033823002/diff/1/src/messages.js File src/messages.js (right): https://codereview.chromium.org/1033823002/diff/1/src/messages.js#newcode201 src/messages.js:201: strict_for_in_loop_initializer: ["for-in loop variable declaration may not have an ...
5 years, 9 months ago (2015-03-25 09:17:43 UTC) #5
caitp (gmail)
https://codereview.chromium.org/1033823002/diff/1/src/messages.js File src/messages.js (right): https://codereview.chromium.org/1033823002/diff/1/src/messages.js#newcode201 src/messages.js:201: strict_for_in_loop_initializer: ["for-in loop variable declaration may not have an ...
5 years, 9 months ago (2015-03-25 11:22:42 UTC) #6
arv (Not doing code reviews)
LGTM https://codereview.chromium.org/1033823002/diff/20001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/1033823002/diff/20001/src/parser.cc#newcode3384 src/parser.cc:3384: (is_strict(language_mode()) || mode == ForEachStatement::ITERATE)) { Add a ...
5 years, 8 months ago (2015-03-31 14:39:15 UTC) #8
marja
You could add a test-parsing test too. https://codereview.chromium.org/1033823002/diff/40001/src/parser.cc File src/parser.cc (left): https://codereview.chromium.org/1033823002/diff/40001/src/parser.cc#oldcode2251 src/parser.cc:2251: Nit: this ...
5 years, 8 months ago (2015-04-07 08:30:34 UTC) #9
caitp (gmail)
Thanks, making these edits https://codereview.chromium.org/1033823002/diff/40001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/1033823002/diff/40001/src/parser.cc#newcode2234 src/parser.cc:2234: VariableDeclarationProperties* decl_props, On 2015/04/07 08:30:34, ...
5 years, 8 months ago (2015-04-07 11:56:20 UTC) #10
caitp (gmail)
I think a test-parsing patch should wait until a followup. Right now, the preparser and ...
5 years, 8 months ago (2015-04-07 14:58:58 UTC) #11
marja
It's ok to add it as a follow up, to keep the patches small.
5 years, 8 months ago (2015-04-07 15:04:02 UTC) #12
marja
lgtm
5 years, 8 months ago (2015-04-07 15:05:53 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1033823002/80001
5 years, 8 months ago (2015-04-07 18:40:09 UTC) #16
caitp (gmail)
On 2015/04/07 15:05:53, marja wrote: > lgtm followup is ready, gonna send CL after this ...
5 years, 8 months ago (2015-04-07 18:40:25 UTC) #17
commit-bot: I haz the power
Committed patchset #5 (id:80001)
5 years, 8 months ago (2015-04-07 19:28:39 UTC) #18
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/1fb76f055a4a0d0a2f5e5d2784b0f070fc279b2b Cr-Commit-Position: refs/heads/master@{#27639}
5 years, 8 months ago (2015-04-07 19:28:53 UTC) #19
caitp (gmail)
5 years, 7 months ago (2015-05-20 14:05:13 UTC) #20
Message was sent while issue was closed.
On 2015/04/07 19:28:53, I haz the power (commit-bot) wrote:
> Patchset 5 (id:??) landed as
> https://crrev.com/1fb76f055a4a0d0a2f5e5d2784b0f070fc279b2b
> Cr-Commit-Position: refs/heads/master@{#27639}

https://bugzilla.mozilla.org/show_bug.cgi?id=1164741 and
https://bugs.webkit.org/show_bug.cgi?id=130269 seem to have partially reverted
the restrictions on initializers in ForIn. We might want to do that too.

:(

Powered by Google App Engine
This is Rietveld 408576698