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

Unified Diff: src/preparser.cc

Issue 1107053002: Parsing binding patterns. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: CR feedback Created 5 years, 8 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
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index d8c84260e2454f36415b6d02ae7de9257a7eee5e..95339dac33ca08b6b87bdf4bfed467c294a93280 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -511,7 +511,7 @@ PreParser::Statement PreParser::ParseVariableDeclarations(
int nvars = 0; // the number of variables declared
int bindings_start = peek_position();
do {
- // Parse variable name.
+ // Parse binding pattern.
if (nvars > 0) Consume(Token::COMMA);
{
ExpressionClassifier pattern_classifier;
@@ -520,12 +520,13 @@ PreParser::Statement PreParser::ParseVariableDeclarations(
ParsePrimaryExpression(&pattern_classifier, CHECK_OK);
ValidateBindingPattern(&pattern_classifier, CHECK_OK);
- if (!pattern.IsIdentifier()) {
+ if (!FLAG_harmony_destructuring && !pattern.IsIdentifier()) {
ReportUnexpectedToken(next);
*ok = false;
return Statement::Default();
}
}
+
Scanner::Location variable_loc = scanner()->location();
nvars++;
if (peek() == Token::ASSIGN || require_initializer ||

Powered by Google App Engine
This is Rietveld 408576698