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

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

Issue 2893313002: [inspector] removed call break location from for-of loop (Closed)
Patch Set: removed each_keyword_pos Created 3 years, 7 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/parser.cc ('k') | src/parsing/preparser.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 #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/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 5617 matching lines...) Expand 10 before | Expand all | Expand 10 after
5628 ForEachStatement::VisitModeString(for_info->mode)); 5628 ForEachStatement::VisitModeString(for_info->mode));
5629 *ok = false; 5629 *ok = false;
5630 return impl()->NullStatement(); 5630 return impl()->NullStatement();
5631 } 5631 }
5632 5632
5633 BlockT init_block = impl()->RewriteForVarInLegacy(*for_info); 5633 BlockT init_block = impl()->RewriteForVarInLegacy(*for_info);
5634 5634
5635 auto loop = factory()->NewForEachStatement(for_info->mode, labels, stmt_pos); 5635 auto loop = factory()->NewForEachStatement(for_info->mode, labels, stmt_pos);
5636 typename Types::Target target(this, loop); 5636 typename Types::Target target(this, loop);
5637 5637
5638 int each_keyword_pos = scanner()->location().beg_pos;
5639
5640 ExpressionT enumerable = impl()->EmptyExpression(); 5638 ExpressionT enumerable = impl()->EmptyExpression();
5641 if (for_info->mode == ForEachStatement::ITERATE) { 5639 if (for_info->mode == ForEachStatement::ITERATE) {
5642 ExpressionClassifier classifier(this); 5640 ExpressionClassifier classifier(this);
5643 enumerable = ParseAssignmentExpression(true, CHECK_OK); 5641 enumerable = ParseAssignmentExpression(true, CHECK_OK);
5644 impl()->RewriteNonPattern(CHECK_OK); 5642 impl()->RewriteNonPattern(CHECK_OK);
5645 } else { 5643 } else {
5646 enumerable = ParseExpression(true, CHECK_OK); 5644 enumerable = ParseExpression(true, CHECK_OK);
5647 } 5645 }
5648 5646
5649 Expect(Token::RPAREN, CHECK_OK); 5647 Expect(Token::RPAREN, CHECK_OK);
5650 5648
5651 StatementT final_loop = impl()->NullStatement(); 5649 StatementT final_loop = impl()->NullStatement();
5652 { 5650 {
5653 ReturnExprScope no_tail_calls(function_state_, 5651 ReturnExprScope no_tail_calls(function_state_,
5654 ReturnExprContext::kInsideForInOfBody); 5652 ReturnExprContext::kInsideForInOfBody);
5655 BlockState block_state(zone(), &scope_); 5653 BlockState block_state(zone(), &scope_);
5656 scope()->set_start_position(scanner()->location().beg_pos); 5654 scope()->set_start_position(scanner()->location().beg_pos);
5657 5655
5658 StatementT body = ParseStatement(nullptr, CHECK_OK); 5656 StatementT body = ParseStatement(nullptr, CHECK_OK);
5659 5657
5660 BlockT body_block = impl()->NullBlock(); 5658 BlockT body_block = impl()->NullBlock();
5661 ExpressionT each_variable = impl()->EmptyExpression(); 5659 ExpressionT each_variable = impl()->EmptyExpression();
5662 impl()->DesugarBindingInForEachStatement(for_info, &body_block, 5660 impl()->DesugarBindingInForEachStatement(for_info, &body_block,
5663 &each_variable, CHECK_OK); 5661 &each_variable, CHECK_OK);
5664 body_block->statements()->Add(body, zone()); 5662 body_block->statements()->Add(body, zone());
5665 final_loop = impl()->InitializeForEachStatement( 5663 final_loop = impl()->InitializeForEachStatement(loop, each_variable,
jgruber 2017/05/23 12:33:57 I'm trying to understand the logic change this CL
5666 loop, each_variable, enumerable, body_block, each_keyword_pos); 5664 enumerable, body_block);
5667 5665
5668 scope()->set_end_position(scanner()->location().end_pos); 5666 scope()->set_end_position(scanner()->location().end_pos);
5669 body_block->set_scope(scope()->FinalizeBlockScope()); 5667 body_block->set_scope(scope()->FinalizeBlockScope());
5670 } 5668 }
5671 5669
5672 init_block = impl()->CreateForEachStatementTDZ(init_block, *for_info, ok); 5670 init_block = impl()->CreateForEachStatementTDZ(init_block, *for_info, ok);
5673 5671
5674 scope()->set_end_position(scanner()->location().end_pos); 5672 scope()->set_end_position(scanner()->location().end_pos);
5675 Scope* for_scope = scope()->FinalizeBlockScope(); 5673 Scope* for_scope = scope()->FinalizeBlockScope();
5676 // Parsed for-in loop w/ variable declarations. 5674 // Parsed for-in loop w/ variable declarations.
(...skipping 16 matching lines...) Expand all
5693 // Initializer is reference followed by in/of. 5691 // Initializer is reference followed by in/of.
5694 if (!expression->IsArrayLiteral() && !expression->IsObjectLiteral()) { 5692 if (!expression->IsArrayLiteral() && !expression->IsObjectLiteral()) {
5695 expression = impl()->CheckAndRewriteReferenceExpression( 5693 expression = impl()->CheckAndRewriteReferenceExpression(
5696 expression, lhs_beg_pos, lhs_end_pos, MessageTemplate::kInvalidLhsInFor, 5694 expression, lhs_beg_pos, lhs_end_pos, MessageTemplate::kInvalidLhsInFor,
5697 kSyntaxError, CHECK_OK); 5695 kSyntaxError, CHECK_OK);
5698 } 5696 }
5699 5697
5700 auto loop = factory()->NewForEachStatement(for_info->mode, labels, stmt_pos); 5698 auto loop = factory()->NewForEachStatement(for_info->mode, labels, stmt_pos);
5701 typename Types::Target target(this, loop); 5699 typename Types::Target target(this, loop);
5702 5700
5703 int each_keyword_pos = scanner()->location().beg_pos;
5704
5705 ExpressionT enumerable = impl()->EmptyExpression(); 5701 ExpressionT enumerable = impl()->EmptyExpression();
5706 if (for_info->mode == ForEachStatement::ITERATE) { 5702 if (for_info->mode == ForEachStatement::ITERATE) {
5707 ExpressionClassifier classifier(this); 5703 ExpressionClassifier classifier(this);
5708 enumerable = ParseAssignmentExpression(true, CHECK_OK); 5704 enumerable = ParseAssignmentExpression(true, CHECK_OK);
5709 impl()->RewriteNonPattern(CHECK_OK); 5705 impl()->RewriteNonPattern(CHECK_OK);
5710 } else { 5706 } else {
5711 enumerable = ParseExpression(true, CHECK_OK); 5707 enumerable = ParseExpression(true, CHECK_OK);
5712 } 5708 }
5713 5709
5714 Expect(Token::RPAREN, CHECK_OK); 5710 Expect(Token::RPAREN, CHECK_OK);
5715 Scope* for_scope = scope(); 5711 Scope* for_scope = scope();
5716 5712
5717 { 5713 {
5718 ReturnExprScope no_tail_calls(function_state_, 5714 ReturnExprScope no_tail_calls(function_state_,
5719 ReturnExprContext::kInsideForInOfBody); 5715 ReturnExprContext::kInsideForInOfBody);
5720 BlockState block_state(zone(), &scope_); 5716 BlockState block_state(zone(), &scope_);
5721 scope()->set_start_position(scanner()->location().beg_pos); 5717 scope()->set_start_position(scanner()->location().beg_pos);
5722 5718
5723 StatementT body = ParseStatement(nullptr, CHECK_OK); 5719 StatementT body = ParseStatement(nullptr, CHECK_OK);
5724 scope()->set_end_position(scanner()->location().end_pos); 5720 scope()->set_end_position(scanner()->location().end_pos);
5725 StatementT final_loop = impl()->InitializeForEachStatement( 5721 StatementT final_loop =
5726 loop, expression, enumerable, body, each_keyword_pos); 5722 impl()->InitializeForEachStatement(loop, expression, enumerable, body);
jgruber 2017/05/23 12:33:57 While here it all depends on whether expression's
kozy 2017/05/23 12:56:28 It's not just refactoring, location for for..of lo
5727 5723
5728 for_scope = for_scope->FinalizeBlockScope(); 5724 for_scope = for_scope->FinalizeBlockScope();
5729 USE(for_scope); 5725 USE(for_scope);
5730 DCHECK_NULL(for_scope); 5726 DCHECK_NULL(for_scope);
5731 Scope* block_scope = scope()->FinalizeBlockScope(); 5727 Scope* block_scope = scope()->FinalizeBlockScope();
5732 USE(block_scope); 5728 USE(block_scope);
5733 DCHECK_NULL(block_scope); 5729 DCHECK_NULL(block_scope);
5734 return final_loop; 5730 return final_loop;
5735 } 5731 }
5736 } 5732 }
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
6018 } 6014 }
6019 6015
6020 #undef CHECK_OK 6016 #undef CHECK_OK
6021 #undef CHECK_OK_CUSTOM 6017 #undef CHECK_OK_CUSTOM
6022 #undef CHECK_OK_VOID 6018 #undef CHECK_OK_VOID
6023 6019
6024 } // namespace internal 6020 } // namespace internal
6025 } // namespace v8 6021 } // namespace v8
6026 6022
6027 #endif // V8_PARSING_PARSER_BASE_H 6023 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698