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

Issue 1471973003: Disallow destructuring in legacy sloppy for-in loop parsing (Closed)

Created:
5 years ago by adamk
Modified:
5 years ago
Reviewers:
Dan Ehrenberg
CC:
rossberg, v8-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Disallow destructuring in legacy sloppy for-in loop parsing For web compat reasons, we support an initializer in the declaration part of a for-in loop. But we should disallow this for destructured declarations (just as we do for lexical declarations). In fact, without disallowing it, we crash. Also fix up the PreParser to have the same restrictions here as the parser (the lexical check was missing there), verified by running the message tests with --min-preparse-length=0. In fixing the logic I've also cleaned up the code a bit, removing the only-called-once DeclarationParsingResult::SingleName method. BUG=v8:811 LOG=n Committed: https://crrev.com/ceb92ebfdfb561d71038793c02b42aa973f55ec4 Cr-Commit-Position: refs/heads/master@{#32236}

Patch Set 1 #

Patch Set 2 : Fix copyright on test #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+36 lines, -39 lines) Patch
M src/parser.h View 1 chunk +0 lines, -1 line 0 comments Download
M src/parser.cc View 4 chunks +11 lines, -22 lines 0 comments Download
M src/preparser.h View 1 chunk +2 lines, -1 line 0 comments Download
M src/preparser.cc View 7 chunks +17 lines, -11 lines 2 comments Download
A + test/message/for-in-loop-initializers-destructuring.js View 1 1 chunk +2 lines, -4 lines 0 comments Download
A test/message/for-in-loop-initializers-destructuring.out View 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (2 generated)
adamk
5 years ago (2015-11-24 19:46:04 UTC) #2
Dan Ehrenberg
lgtm https://codereview.chromium.org/1471973003/diff/20001/src/preparser.cc File src/preparser.cc (right): https://codereview.chromium.org/1471973003/diff/20001/src/preparser.cc#newcode529 src/preparser.cc:529: bool is_pattern = false; Nit: Not sure why ...
5 years ago (2015-11-25 01:02:59 UTC) #3
adamk
Thanks for the quick review! https://codereview.chromium.org/1471973003/diff/20001/src/preparser.cc File src/preparser.cc (right): https://codereview.chromium.org/1471973003/diff/20001/src/preparser.cc#newcode529 src/preparser.cc:529: bool is_pattern = false; ...
5 years ago (2015-11-25 01:13:12 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1471973003/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1471973003/20001
5 years ago (2015-11-25 01:13:19 UTC) #6
commit-bot: I haz the power
Committed patchset #2 (id:20001)
5 years ago (2015-11-25 01:15:04 UTC) #7
commit-bot: I haz the power
5 years ago (2015-11-25 01:15:33 UTC) #8
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/ceb92ebfdfb561d71038793c02b42aa973f55ec4
Cr-Commit-Position: refs/heads/master@{#32236}

Powered by Google App Engine
This is Rietveld 408576698