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

Side by Side Diff: src/preparser.cc

Issue 1167393005: [destructuring] Parse binding patterns in formal parameters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: CR feedback + rebase Created 5 years, 6 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/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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 do { 542 do {
543 // Parse binding pattern. 543 // Parse binding pattern.
544 if (nvars > 0) Consume(Token::COMMA); 544 if (nvars > 0) Consume(Token::COMMA);
545 { 545 {
546 ExpressionClassifier pattern_classifier; 546 ExpressionClassifier pattern_classifier;
547 Token::Value next = peek(); 547 Token::Value next = peek();
548 PreParserExpression pattern = 548 PreParserExpression pattern =
549 ParsePrimaryExpression(&pattern_classifier, CHECK_OK); 549 ParsePrimaryExpression(&pattern_classifier, CHECK_OK);
550 ValidateBindingPattern(&pattern_classifier, CHECK_OK); 550 ValidateBindingPattern(&pattern_classifier, CHECK_OK);
551 551
552 if (!FLAG_harmony_destructuring && !pattern.IsIdentifier()) { 552 if (!allow_harmony_destructuring() && !pattern.IsIdentifier()) {
553 ReportUnexpectedToken(next); 553 ReportUnexpectedToken(next);
554 *ok = false; 554 *ok = false;
555 return Statement::Default(); 555 return Statement::Default();
556 } 556 }
557 } 557 }
558 558
559 Scanner::Location variable_loc = scanner()->location(); 559 Scanner::Location variable_loc = scanner()->location();
560 nvars++; 560 nvars++;
561 if (peek() == Token::ASSIGN || require_initializer || 561 if (peek() == Token::ASSIGN || require_initializer ||
562 // require initializers for multiple consts. 562 // require initializers for multiple consts.
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 1186
1187 DCHECK(!spread_pos.IsValid()); 1187 DCHECK(!spread_pos.IsValid());
1188 1188
1189 return Expression::Default(); 1189 return Expression::Default();
1190 } 1190 }
1191 1191
1192 #undef CHECK_OK 1192 #undef CHECK_OK
1193 1193
1194 1194
1195 } } // v8::internal 1195 } } // v8::internal
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698