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

Issue 2697193007: Report unexpected lexical decl also without destructuring (Closed)

Created:
3 years, 10 months ago by vabr (Chromium)
Modified:
3 years, 10 months ago
Reviewers:
Dan Ehrenberg
CC:
v8-reviews_googlegroups.com
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Report unexpected lexical decl also without destructuring https://codereview.chromium.org/2694003002/ introduced "SyntaxError: Lexical declaration cannot appear in a single-statement context" for the case when let + desctructuring from a list happen. As was pointed out in https://codereview.chromium.org/2694003002/#msg18, the case without destructuring would also benefit from a better message: if a single statement is expected and "let identifier = ..." is seen, the error is indeed again that the lexical declaration is not a statement. However, the current error is "Unexpected identifier", because the parser tries to accept "let" as an identifier in an expression statement, and then gives up seeing the other identifier after "let". This CL ensures that the parser recognises the error properly and reports accordingly. It also renames the existing test, which contains destructuring, and adds the one with a non-destructuring lexical declaration. BUG=v8:5686 Review-Url: https://codereview.chromium.org/2697193007 Cr-Commit-Position: refs/heads/master@{#43275} Committed: https://chromium.googlesource.com/v8/v8/+/454816f08f8c4f52b15176f204e123488474e4a4

Patch Set 1 #

Total comments: 2

Patch Set 2 : Add brace #

Total comments: 3

Messages

Total messages: 24 (17 generated)
vabr (Chromium)
Hi Dan, Is this a good follow-up to your comment about the ugly error for ...
3 years, 10 months ago (2017-02-16 21:27:30 UTC) #8
Dan Ehrenberg
https://codereview.chromium.org/2697193007/diff/1/src/parsing/parser-base.h File src/parsing/parser-base.h (right): https://codereview.chromium.org/2697193007/diff/1/src/parsing/parser-base.h#newcode4939 src/parsing/parser-base.h:4939: if (next_next != Token::LBRACK && next_next != Token::IDENTIFIER) break; ...
3 years, 10 months ago (2017-02-17 08:37:14 UTC) #9
vabr (Chromium)
Thanks, Dan! Please have a look at how I addressed your comment. Cheers, Vaclav https://codereview.chromium.org/2697193007/diff/1/src/parsing/parser-base.h ...
3 years, 10 months ago (2017-02-17 09:52:08 UTC) #15
Dan Ehrenberg
lgtm Great job here, I admire your attention to details. https://codereview.chromium.org/2697193007/diff/20001/test/message/let-lexical-declaration-destructuring-in-single-statement.js File test/message/let-lexical-declaration-destructuring-in-single-statement.js (right): https://codereview.chromium.org/2697193007/diff/20001/test/message/let-lexical-declaration-destructuring-in-single-statement.js#newcode5 ...
3 years, 10 months ago (2017-02-17 09:54:35 UTC) #16
vabr (Chromium)
Thanks for your quick and helpful reviews! Vaclav https://codereview.chromium.org/2697193007/diff/20001/test/message/let-lexical-declaration-destructuring-in-single-statement.js File test/message/let-lexical-declaration-destructuring-in-single-statement.js (right): https://codereview.chromium.org/2697193007/diff/20001/test/message/let-lexical-declaration-destructuring-in-single-statement.js#newcode5 test/message/let-lexical-declaration-destructuring-in-single-statement.js:5: with ...
3 years, 10 months ago (2017-02-17 10:55:46 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2697193007/20001
3 years, 10 months ago (2017-02-17 10:55:57 UTC) #21
commit-bot: I haz the power
3 years, 10 months ago (2017-02-17 10:57:39 UTC) #24
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://chromium.googlesource.com/v8/v8/+/454816f08f8c4f52b15176f204e12348847...

Powered by Google App Engine
This is Rietveld 408576698