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

Side by Side Diff: src/parsing/parser-base.h

Issue 2084703005: Fix bug with illegal spread as single arrow parameter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 | « no previous file | test/mjsunit/harmony/regress/regress-crbug-621496.js » ('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 #ifndef V8_PARSING_PARSER_BASE_H 5 #ifndef V8_PARSING_PARSER_BASE_H
6 #define V8_PARSING_PARSER_BASE_H 6 #define V8_PARSING_PARSER_BASE_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/hashmap.h" 10 #include "src/base/hashmap.h"
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 return factory()->NewEmptyParentheses(beg_pos); 1585 return factory()->NewEmptyParentheses(beg_pos);
1586 } else if (Check(Token::ELLIPSIS)) { 1586 } else if (Check(Token::ELLIPSIS)) {
1587 // (...x)=>x. The continuation that looks for the => is in 1587 // (...x)=>x. The continuation that looks for the => is in
1588 // ParseAssignmentExpression. 1588 // ParseAssignmentExpression.
1589 int ellipsis_pos = position(); 1589 int ellipsis_pos = position();
1590 int expr_pos = peek_position(); 1590 int expr_pos = peek_position();
1591 classifier->RecordExpressionError(scanner()->location(), 1591 classifier->RecordExpressionError(scanner()->location(),
1592 MessageTemplate::kUnexpectedToken, 1592 MessageTemplate::kUnexpectedToken,
1593 Token::String(Token::ELLIPSIS)); 1593 Token::String(Token::ELLIPSIS));
1594 classifier->RecordNonSimpleParameter(); 1594 classifier->RecordNonSimpleParameter();
1595 ExpressionT expr = 1595 ExpressionClassifier binding_classifier(this);
1596 this->ParseAssignmentExpression(true, classifier, CHECK_OK); 1596 ExpressionT expr = this->ParseAssignmentExpression(
1597 true, &binding_classifier, CHECK_OK);
1598 classifier->Accumulate(&binding_classifier,
1599 ExpressionClassifier::AllProductions);
nickie 2016/06/22 09:35:55 This is now identical to the code handling spreads
1597 if (!this->IsIdentifier(expr) && !IsValidPattern(expr)) { 1600 if (!this->IsIdentifier(expr) && !IsValidPattern(expr)) {
1598 classifier->RecordArrowFormalParametersError( 1601 classifier->RecordArrowFormalParametersError(
1599 Scanner::Location(ellipsis_pos, scanner()->location().end_pos), 1602 Scanner::Location(ellipsis_pos, scanner()->location().end_pos),
1600 MessageTemplate::kInvalidRestParameter); 1603 MessageTemplate::kInvalidRestParameter);
1601 } 1604 }
1602 if (peek() == Token::COMMA) { 1605 if (peek() == Token::COMMA) {
1603 ReportMessageAt(scanner()->peek_location(), 1606 ReportMessageAt(scanner()->peek_location(),
1604 MessageTemplate::kParamAfterRest); 1607 MessageTemplate::kParamAfterRest);
1605 *ok = false; 1608 *ok = false;
1606 return this->EmptyExpression(); 1609 return this->EmptyExpression();
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
3627 has_seen_constructor_ = true; 3630 has_seen_constructor_ = true;
3628 return; 3631 return;
3629 } 3632 }
3630 } 3633 }
3631 3634
3632 3635
3633 } // namespace internal 3636 } // namespace internal
3634 } // namespace v8 3637 } // namespace v8
3635 3638
3636 #endif // V8_PARSING_PARSER_BASE_H 3639 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/regress/regress-crbug-621496.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698