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

Side by Side Diff: runtime/vm/parser.cc

Issue 2740783007: Fix debugger regression in issue 28980 (Closed)
Patch Set: wip Created 3 years, 9 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 | « runtime/vm/parser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 3691 matching lines...) Expand 10 before | Expand all | Expand 10 after
3702 } 3702 }
3703 3703
3704 ASSERT(func.end_token_pos() == func.token_pos() || 3704 ASSERT(func.end_token_pos() == func.token_pos() ||
3705 func.end_token_pos() == end_token_pos); 3705 func.end_token_pos() == end_token_pos);
3706 func.set_end_token_pos(end_token_pos); 3706 func.set_end_token_pos(end_token_pos);
3707 SequenceNode* body = CloseBlock(); 3707 SequenceNode* body = CloseBlock();
3708 if (func.IsAsyncFunction()) { 3708 if (func.IsAsyncFunction()) {
3709 body = CloseAsyncFunction(generated_body_closure, body); 3709 body = CloseAsyncFunction(generated_body_closure, body);
3710 generated_body_closure.set_end_token_pos(end_token_pos); 3710 generated_body_closure.set_end_token_pos(end_token_pos);
3711 } else if (func.IsAsyncClosure()) { 3711 } else if (func.IsAsyncClosure()) {
3712 body = CloseAsyncClosure(body); 3712 body = CloseAsyncClosure(body, end_token_pos);
3713 } else if (func.IsSyncGenerator()) { 3713 } else if (func.IsSyncGenerator()) {
3714 body = CloseSyncGenFunction(generated_body_closure, body); 3714 body = CloseSyncGenFunction(generated_body_closure, body);
3715 generated_body_closure.set_end_token_pos(end_token_pos); 3715 generated_body_closure.set_end_token_pos(end_token_pos);
3716 } else if (func.IsSyncGenClosure()) { 3716 } else if (func.IsSyncGenClosure()) {
3717 // body is unchanged. 3717 // body is unchanged.
3718 } else if (func.IsAsyncGenerator()) { 3718 } else if (func.IsAsyncGenerator()) {
3719 body = CloseAsyncGeneratorFunction(generated_body_closure, body); 3719 body = CloseAsyncGeneratorFunction(generated_body_closure, body);
3720 generated_body_closure.set_end_token_pos(end_token_pos); 3720 generated_body_closure.set_end_token_pos(end_token_pos);
3721 } else if (func.IsAsyncGenClosure()) { 3721 } else if (func.IsAsyncGenClosure()) {
3722 body = CloseAsyncGeneratorClosure(body); 3722 body = CloseAsyncGeneratorClosure(body);
(...skipping 2989 matching lines...) Expand 10 before | Expand all | Expand 10 after
6712 const intptr_t try_index = try_statement->try_index(); 6712 const intptr_t try_index = try_statement->try_index();
6713 6713
6714 AstNode* try_catch_node = new (Z) 6714 AstNode* try_catch_node = new (Z)
6715 TryCatchNode(TokenPosition::kNoSource, body, context_var, catch_clause, 6715 TryCatchNode(TokenPosition::kNoSource, body, context_var, catch_clause,
6716 finally_clause, try_index, finally_clause); 6716 finally_clause, try_index, finally_clause);
6717 current_block_->statements->Add(try_catch_node); 6717 current_block_->statements->Add(try_catch_node);
6718 return CloseBlock(); 6718 return CloseBlock();
6719 } 6719 }
6720 6720
6721 6721
6722 SequenceNode* Parser::CloseAsyncTryBlock(SequenceNode* try_block) { 6722 SequenceNode* Parser::CloseAsyncTryBlock(SequenceNode* try_block,
6723 TokenPosition func_end_pos) {
6723 // This is the outermost try-catch of the function. 6724 // This is the outermost try-catch of the function.
6724 ASSERT(try_stack_ != NULL); 6725 ASSERT(try_stack_ != NULL);
6725 ASSERT(try_stack_->outer_try() == NULL); 6726 ASSERT(try_stack_->outer_try() == NULL);
6726 ASSERT(innermost_function().IsAsyncClosure()); 6727 ASSERT(innermost_function().IsAsyncClosure());
6727 LocalScope* try_scope = current_block_->scope; 6728 LocalScope* try_scope = current_block_->scope;
6728 6729
6729 try_stack_->enter_catch(); 6730 try_stack_->enter_catch();
6730 6731
6731 OpenBlock(); // Catch handler list. 6732 OpenBlock(); // Catch handler list.
6732 OpenBlock(); // Catch block. 6733 OpenBlock(); // Catch block.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
6781 LocalVariable* async_completer = 6782 LocalVariable* async_completer =
6782 current_block_->scope->LookupVariable(Symbols::AsyncCompleter(), false); 6783 current_block_->scope->LookupVariable(Symbols::AsyncCompleter(), false);
6783 ASSERT(async_completer != NULL); 6784 ASSERT(async_completer != NULL);
6784 ArgumentListNode* completer_args = 6785 ArgumentListNode* completer_args =
6785 new (Z) ArgumentListNode(TokenPosition::kNoSource); 6786 new (Z) ArgumentListNode(TokenPosition::kNoSource);
6786 completer_args->Add( 6787 completer_args->Add(
6787 new (Z) LoadLocalNode(TokenPosition::kNoSource, exception_param.var)); 6788 new (Z) LoadLocalNode(TokenPosition::kNoSource, exception_param.var));
6788 completer_args->Add( 6789 completer_args->Add(
6789 new (Z) LoadLocalNode(TokenPosition::kNoSource, stack_trace_param.var)); 6790 new (Z) LoadLocalNode(TokenPosition::kNoSource, stack_trace_param.var));
6790 current_block_->statements->Add(new (Z) InstanceCallNode( 6791 current_block_->statements->Add(new (Z) InstanceCallNode(
6791 TokenPos(), 6792 func_end_pos,
6792 new (Z) LoadLocalNode(TokenPosition::kNoSource, async_completer), 6793 new (Z) LoadLocalNode(TokenPosition::kNoSource, async_completer),
6793 Symbols::CompleterCompleteError(), completer_args)); 6794 Symbols::CompleterCompleteError(), completer_args));
6794 ReturnNode* return_node = new (Z) ReturnNode(TokenPosition::kNoSource); 6795 ReturnNode* return_node = new (Z) ReturnNode(TokenPosition::kNoSource);
6795 // Behavior like a continuation return, i.e,. don't call a completer. 6796 // Behavior like a continuation return, i.e,. don't call a completer.
6796 return_node->set_return_type(ReturnNode::kContinuation); 6797 return_node->set_return_type(ReturnNode::kContinuation);
6797 current_block_->statements->Add(return_node); 6798 current_block_->statements->Add(return_node);
6798 AstNode* catch_block = CloseBlock(); 6799 AstNode* catch_block = CloseBlock();
6799 current_block_->statements->Add(catch_block); 6800 current_block_->statements->Add(catch_block);
6800 SequenceNode* catch_handler_list = CloseBlock(); 6801 SequenceNode* catch_handler_list = CloseBlock();
6801 6802
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
7561 ReturnNode* return_node = new (Z) ReturnNode( 7562 ReturnNode* return_node = new (Z) ReturnNode(
7562 token_pos, 7563 token_pos,
7563 new (Z) InstanceGetterNode( 7564 new (Z) InstanceGetterNode(
7564 token_pos, new (Z) LoadLocalNode(token_pos, async_completer), 7565 token_pos, new (Z) LoadLocalNode(token_pos, async_completer),
7565 Symbols::CompleterFuture())); 7566 Symbols::CompleterFuture()));
7566 current_block_->statements->Add(return_node); 7567 current_block_->statements->Add(return_node);
7567 return CloseBlock(); 7568 return CloseBlock();
7568 } 7569 }
7569 7570
7570 7571
7571 SequenceNode* Parser::CloseAsyncClosure(SequenceNode* body) { 7572 SequenceNode* Parser::CloseAsyncClosure(SequenceNode* body,
7573 TokenPosition func_end_pos) {
7572 // We need a temporary expression to store intermediate return values. 7574 // We need a temporary expression to store intermediate return values.
7573 parsed_function()->EnsureExpressionTemp(); 7575 parsed_function()->EnsureExpressionTemp();
7574 7576
7575 SequenceNode* new_body = CloseAsyncTryBlock(body); 7577 SequenceNode* new_body = CloseAsyncTryBlock(body, func_end_pos);
7576 ASSERT(new_body != NULL); 7578 ASSERT(new_body != NULL);
7577 ASSERT(new_body->scope() != NULL); 7579 ASSERT(new_body->scope() != NULL);
7578 return new_body; 7580 return new_body;
7579 } 7581 }
7580 7582
7581 7583
7582 // Set up default values for all optional parameters to the function. 7584 // Set up default values for all optional parameters to the function.
7583 void Parser::SetupDefaultsForOptionalParams(const ParamList& params) { 7585 void Parser::SetupDefaultsForOptionalParams(const ParamList& params) {
7584 if ((current_function().raw() == innermost_function().raw()) && 7586 if ((current_function().raw() == innermost_function().raw()) &&
7585 (params.num_optional_parameters > 0)) { 7587 (params.num_optional_parameters > 0)) {
(...skipping 7614 matching lines...) Expand 10 before | Expand all | Expand 10 after
15200 const ArgumentListNode& function_args, 15202 const ArgumentListNode& function_args,
15201 const LocalVariable* temp_for_last_arg, 15203 const LocalVariable* temp_for_last_arg,
15202 bool is_super_invocation) { 15204 bool is_super_invocation) {
15203 UNREACHABLE(); 15205 UNREACHABLE();
15204 return NULL; 15206 return NULL;
15205 } 15207 }
15206 15208
15207 } // namespace dart 15209 } // namespace dart
15208 15210
15209 #endif // DART_PRECOMPILED_RUNTIME 15211 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « runtime/vm/parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698