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

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

Issue 2086513002: Fix classifier related bug (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix patch (&^%$#@! similarity) 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-621111.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 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 return result; 1669 return result;
1670 } 1670 }
1671 1671
1672 template <class Traits> 1672 template <class Traits>
1673 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseExpression( 1673 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseExpression(
1674 bool accept_IN, ExpressionClassifier* classifier, bool* ok) { 1674 bool accept_IN, ExpressionClassifier* classifier, bool* ok) {
1675 // Expression :: 1675 // Expression ::
1676 // AssignmentExpression 1676 // AssignmentExpression
1677 // Expression ',' AssignmentExpression 1677 // Expression ',' AssignmentExpression
1678 1678
1679 ExpressionClassifier binding_classifier(this); 1679 ExpressionT result = this->EmptyExpression();
1680 ExpressionT result = 1680 {
1681 this->ParseAssignmentExpression(accept_IN, &binding_classifier, CHECK_OK); 1681 ExpressionClassifier binding_classifier(this);
1682 classifier->Accumulate(&binding_classifier, 1682 result = this->ParseAssignmentExpression(accept_IN, &binding_classifier,
1683 ExpressionClassifier::AllProductions); 1683 CHECK_OK);
1684 classifier->Accumulate(&binding_classifier,
1685 ExpressionClassifier::AllProductions);
1686 }
1684 bool is_simple_parameter_list = this->IsIdentifier(result); 1687 bool is_simple_parameter_list = this->IsIdentifier(result);
1685 bool seen_rest = false; 1688 bool seen_rest = false;
1686 while (peek() == Token::COMMA) { 1689 while (peek() == Token::COMMA) {
1687 CheckNoTailCallExpressions(classifier, CHECK_OK); 1690 CheckNoTailCallExpressions(classifier, CHECK_OK);
1688 if (seen_rest) { 1691 if (seen_rest) {
1689 // At this point the production can't possibly be valid, but we don't know 1692 // At this point the production can't possibly be valid, but we don't know
1690 // which error to signal. 1693 // which error to signal.
1691 classifier->RecordArrowFormalParametersError( 1694 classifier->RecordArrowFormalParametersError(
1692 scanner()->peek_location(), MessageTemplate::kParamAfterRest); 1695 scanner()->peek_location(), MessageTemplate::kParamAfterRest);
1693 } 1696 }
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after
3336 body = this->ParseEagerFunctionBody( 3339 body = this->ParseEagerFunctionBody(
3337 this->EmptyIdentifier(), RelocInfo::kNoPosition, formal_parameters, 3340 this->EmptyIdentifier(), RelocInfo::kNoPosition, formal_parameters,
3338 arrow_kind, FunctionLiteral::kAnonymousExpression, CHECK_OK); 3341 arrow_kind, FunctionLiteral::kAnonymousExpression, CHECK_OK);
3339 materialized_literal_count = 3342 materialized_literal_count =
3340 function_state.materialized_literal_count(); 3343 function_state.materialized_literal_count();
3341 expected_property_count = function_state.expected_property_count(); 3344 expected_property_count = function_state.expected_property_count();
3342 } 3345 }
3343 } else { 3346 } else {
3344 // Single-expression body 3347 // Single-expression body
3345 int pos = position(); 3348 int pos = position();
3346 ExpressionClassifier classifier(this);
3347 DCHECK(ReturnExprContext::kInsideValidBlock == 3349 DCHECK(ReturnExprContext::kInsideValidBlock ==
3348 function_state_->return_expr_context()); 3350 function_state_->return_expr_context());
3349 ReturnExprScope allow_tail_calls( 3351 ReturnExprScope allow_tail_calls(
3350 function_state_, ReturnExprContext::kInsideValidReturnStatement); 3352 function_state_, ReturnExprContext::kInsideValidReturnStatement);
3351 body = this->NewStatementList(1, zone()); 3353 body = this->NewStatementList(1, zone());
3352 this->AddParameterInitializationBlock(formal_parameters, body, is_async, 3354 this->AddParameterInitializationBlock(formal_parameters, body, is_async,
3353 CHECK_OK); 3355 CHECK_OK);
3356 ExpressionClassifier classifier(this);
nickie 2016/06/21 08:13:24 (Copying commend from previous PS.) This change w
3354 if (is_async) { 3357 if (is_async) {
3355 this->ParseAsyncArrowSingleExpressionBody(body, accept_IN, &classifier, 3358 this->ParseAsyncArrowSingleExpressionBody(body, accept_IN, &classifier,
3356 pos, CHECK_OK); 3359 pos, CHECK_OK);
3357 Traits::RewriteNonPattern(&classifier, CHECK_OK); 3360 Traits::RewriteNonPattern(&classifier, CHECK_OK);
3358 } else { 3361 } else {
3359 ExpressionT expression = 3362 ExpressionT expression =
3360 ParseAssignmentExpression(accept_IN, &classifier, CHECK_OK); 3363 ParseAssignmentExpression(accept_IN, &classifier, CHECK_OK);
3361 Traits::RewriteNonPattern(&classifier, CHECK_OK); 3364 Traits::RewriteNonPattern(&classifier, CHECK_OK);
3362 body->Add(factory()->NewReturnStatement(expression, pos), zone()); 3365 body->Add(factory()->NewReturnStatement(expression, pos), zone());
3363 if (allow_tailcalls() && !is_sloppy(language_mode())) { 3366 if (allow_tailcalls() && !is_sloppy(language_mode())) {
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
3619 has_seen_constructor_ = true; 3622 has_seen_constructor_ = true;
3620 return; 3623 return;
3621 } 3624 }
3622 } 3625 }
3623 3626
3624 3627
3625 } // namespace internal 3628 } // namespace internal
3626 } // namespace v8 3629 } // namespace v8
3627 3630
3628 #endif // V8_PARSING_PARSER_BASE_H 3631 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/regress/regress-crbug-621111.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698