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

Side by Side Diff: src/parsing/preparser.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/parsing/preparser.h ('k') | test/cctest/test-parsing.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 <cmath> 5 #include <cmath>
6 6
7 #include "src/allocation.h" 7 #include "src/allocation.h"
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 ValidateLetPattern(&pattern_classifier, CHECK_OK); 584 ValidateLetPattern(&pattern_classifier, CHECK_OK);
585 } 585 }
586 586
587 if (!allow_harmony_destructuring_bind() && !pattern.IsIdentifier()) { 587 if (!allow_harmony_destructuring_bind() && !pattern.IsIdentifier()) {
588 ReportUnexpectedToken(next); 588 ReportUnexpectedToken(next);
589 *ok = false; 589 *ok = false;
590 return Statement::Default(); 590 return Statement::Default();
591 } 591 }
592 } 592 }
593 593
594 is_pattern = pattern.IsObjectLiteral() || pattern.IsArrayLiteral(); 594 is_pattern = (pattern.IsObjectLiteral() || pattern.IsArrayLiteral()) &&
595 !pattern.is_parenthesized();
595 596
596 bool is_for_iteration_variable = 597 bool is_for_iteration_variable =
597 var_context == kForStatement && 598 var_context == kForStatement &&
598 (peek() == Token::IN || PeekContextualKeyword(CStrVector("of"))); 599 (peek() == Token::IN || PeekContextualKeyword(CStrVector("of")));
599 600
600 Scanner::Location variable_loc = scanner()->location(); 601 Scanner::Location variable_loc = scanner()->location();
601 nvars++; 602 nvars++;
602 if (Check(Token::ASSIGN)) { 603 if (Check(Token::ASSIGN)) {
603 ExpressionClassifier classifier; 604 ExpressionClassifier classifier;
604 ParseAssignmentExpression(var_context != kForStatement, &classifier, 605 ParseAssignmentExpression(var_context != kForStatement, &classifier,
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 Expect(Token::RBRACE, CHECK_OK); 1283 Expect(Token::RBRACE, CHECK_OK);
1283 return PreParserExpression::Default(); 1284 return PreParserExpression::Default();
1284 } 1285 }
1285 } 1286 }
1286 1287
1287 #undef CHECK_OK 1288 #undef CHECK_OK
1288 1289
1289 1290
1290 } // namespace internal 1291 } // namespace internal
1291 } // namespace v8 1292 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698