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

Side by Side Diff: src/parsing/parser.cc

Issue 1570793002: [parser] parenthesized Literals are not valid AssignmentPatterns (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add TODO + move ParenthesizedField line above Type-dependent fields/comments 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 unified diff | Download patch
« no previous file with comments | « src/ast/ast.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/parsing/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/ast-expression-visitor.h" 9 #include "src/ast/ast-expression-visitor.h"
10 #include "src/ast/ast-literal-reindexer.h" 10 #include "src/ast/ast-literal-reindexer.h"
(...skipping 2348 matching lines...) Expand 10 before | Expand all | Expand 10 after
2359 ValidateLetPattern(&pattern_classifier, ok); 2359 ValidateLetPattern(&pattern_classifier, ok);
2360 if (!*ok) return; 2360 if (!*ok) return;
2361 } 2361 }
2362 if (!allow_harmony_destructuring_bind() && !pattern->IsVariableProxy()) { 2362 if (!allow_harmony_destructuring_bind() && !pattern->IsVariableProxy()) {
2363 ReportUnexpectedToken(next); 2363 ReportUnexpectedToken(next);
2364 *ok = false; 2364 *ok = false;
2365 return; 2365 return;
2366 } 2366 }
2367 } 2367 }
2368 2368
2369 bool is_pattern = pattern->IsObjectLiteral() || pattern->IsArrayLiteral(); 2369 bool is_pattern =
2370 (pattern->IsObjectLiteral() || pattern->IsArrayLiteral()) &&
2371 !pattern->is_parenthesized();
2370 2372
2371 Scanner::Location variable_loc = scanner()->location(); 2373 Scanner::Location variable_loc = scanner()->location();
2372 const AstRawString* single_name = 2374 const AstRawString* single_name =
2373 pattern->IsVariableProxy() ? pattern->AsVariableProxy()->raw_name() 2375 pattern->IsVariableProxy() ? pattern->AsVariableProxy()->raw_name()
2374 : nullptr; 2376 : nullptr;
2375 if (single_name != nullptr) { 2377 if (single_name != nullptr) {
2376 if (fni_ != NULL) fni_->PushVariableName(single_name); 2378 if (fni_ != NULL) fni_->PushVariableName(single_name);
2377 } 2379 }
2378 2380
2379 is_for_iteration_variable = 2381 is_for_iteration_variable =
(...skipping 3070 matching lines...) Expand 10 before | Expand all | Expand 10 after
5450 auto class_literal = value->AsClassLiteral(); 5452 auto class_literal = value->AsClassLiteral();
5451 if (class_literal->raw_name() == nullptr) { 5453 if (class_literal->raw_name() == nullptr) {
5452 class_literal->set_raw_name(name); 5454 class_literal->set_raw_name(name);
5453 } 5455 }
5454 } 5456 }
5455 } 5457 }
5456 5458
5457 5459
5458 } // namespace internal 5460 } // namespace internal
5459 } // namespace v8 5461 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698