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

Unified Diff: src/parsing/parser-base.h

Issue 1585473002: [parser] reject parenthesized patterns as DestructuringAssignmentTargets (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove the extra check Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index a5e757782b064ccae49e4c49f20cc47e70abdd8b..faea8b581b4703f01ff7624d73ae977c56ba6e95 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -3277,8 +3277,13 @@ void ParserBase<Traits>::CheckDestructuringElement(
MessageTemplate::kInvalidDestructuringTarget;
const Scanner::Location location(begin, end);
if (expression->IsArrayLiteral() || expression->IsObjectLiteral() ||
- expression->IsAssignment())
+ expression->IsAssignment()) {
+ if (expression->is_parenthesized()) {
+ classifier->RecordPatternError(location, message);
+ }
return;
+ }
+
if (expression->IsProperty()) {
classifier->RecordBindingPatternError(location, message);
} else if (!this->IsAssignableIdentifier(expression)) {
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698