| OLD | NEW |
| 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 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/ast_transformer.h" | 9 #include "vm/ast_transformer.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 5961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5972 Scanner::kNoSourcePos, | 5972 Scanner::kNoSourcePos, |
| 5973 exception_param.var, | 5973 exception_param.var, |
| 5974 new(Z) LoadLocalNode(Scanner::kNoSourcePos, exception_var))); | 5974 new(Z) LoadLocalNode(Scanner::kNoSourcePos, exception_var))); |
| 5975 } | 5975 } |
| 5976 LocalVariable* stack_trace_var = | 5976 LocalVariable* stack_trace_var = |
| 5977 current_block_->scope->LookupVariable(Symbols::StackTraceVar(), false); | 5977 current_block_->scope->LookupVariable(Symbols::StackTraceVar(), false); |
| 5978 if (stack_trace_param.var != NULL) { | 5978 if (stack_trace_param.var != NULL) { |
| 5979 // A stack trace variable is specified in this block, so generate code | 5979 // A stack trace variable is specified in this block, so generate code |
| 5980 // to load the stack trace object (:stack_trace_var) into the stack | 5980 // to load the stack trace object (:stack_trace_var) into the stack |
| 5981 // trace variable specified in this block. | 5981 // trace variable specified in this block. |
| 5982 ArgumentListNode* no_args = new(Z) ArgumentListNode(Scanner::kNoSourcePos); | |
| 5983 ASSERT(stack_trace_var != NULL); | 5982 ASSERT(stack_trace_var != NULL); |
| 5984 current_block_->statements->Add(new(Z) StoreLocalNode( | 5983 current_block_->statements->Add(new(Z) StoreLocalNode( |
| 5985 Scanner::kNoSourcePos, | 5984 Scanner::kNoSourcePos, |
| 5986 stack_trace_param.var, | 5985 stack_trace_param.var, |
| 5987 new(Z) LoadLocalNode(Scanner::kNoSourcePos, stack_trace_var))); | 5986 new(Z) LoadLocalNode(Scanner::kNoSourcePos, stack_trace_var))); |
| 5988 current_block_->statements->Add(new(Z) InstanceCallNode( | |
| 5989 Scanner::kNoSourcePos, | |
| 5990 new(Z) LoadLocalNode(Scanner::kNoSourcePos, stack_trace_param.var), | |
| 5991 Library::PrivateCoreLibName(Symbols::_setupFullStackTrace()), | |
| 5992 no_args)); | |
| 5993 } | 5987 } |
| 5994 | 5988 |
| 5995 ASSERT(try_blocks_list_ != NULL); | 5989 ASSERT(try_blocks_list_ != NULL); |
| 5996 ASSERT(innermost_function().IsAsyncClosure() || | 5990 ASSERT(innermost_function().IsAsyncClosure() || |
| 5997 innermost_function().IsAsyncFunction()); | 5991 innermost_function().IsAsyncFunction()); |
| 5998 if ((try_blocks_list_->outer_try_block() != NULL) && | 5992 if ((try_blocks_list_->outer_try_block() != NULL) && |
| 5999 (try_blocks_list_->outer_try_block()->try_block() | 5993 (try_blocks_list_->outer_try_block()->try_block() |
| 6000 ->scope->function_level() == | 5994 ->scope->function_level() == |
| 6001 current_block_->scope->function_level())) { | 5995 current_block_->scope->function_level())) { |
| 6002 // We need to unchain three scope levels: catch clause, catch | 5996 // We need to unchain three scope levels: catch clause, catch |
| (...skipping 2344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8347 ASSERT(exception_var != NULL); | 8341 ASSERT(exception_var != NULL); |
| 8348 current_block_->statements->Add(new(Z) StoreLocalNode( | 8342 current_block_->statements->Add(new(Z) StoreLocalNode( |
| 8349 catch_pos, exception_param.var, new(Z) LoadLocalNode( | 8343 catch_pos, exception_param.var, new(Z) LoadLocalNode( |
| 8350 catch_pos, exception_var))); | 8344 catch_pos, exception_var))); |
| 8351 } | 8345 } |
| 8352 if (stack_trace_param.var != NULL) { | 8346 if (stack_trace_param.var != NULL) { |
| 8353 // A stack trace variable is specified in this block, so generate code | 8347 // A stack trace variable is specified in this block, so generate code |
| 8354 // to load the stack trace object (:stack_trace_var) into the stack | 8348 // to load the stack trace object (:stack_trace_var) into the stack |
| 8355 // trace variable specified in this block. | 8349 // trace variable specified in this block. |
| 8356 *needs_stack_trace = true; | 8350 *needs_stack_trace = true; |
| 8357 ArgumentListNode* no_args = new(Z) ArgumentListNode(catch_pos); | |
| 8358 ASSERT(stack_trace_var != NULL); | 8351 ASSERT(stack_trace_var != NULL); |
| 8359 current_block_->statements->Add(new(Z) StoreLocalNode( | 8352 current_block_->statements->Add(new(Z) StoreLocalNode( |
| 8360 catch_pos, stack_trace_param.var, new(Z) LoadLocalNode( | 8353 catch_pos, stack_trace_param.var, new(Z) LoadLocalNode( |
| 8361 catch_pos, stack_trace_var))); | 8354 catch_pos, stack_trace_var))); |
| 8362 current_block_->statements->Add(new(Z) InstanceCallNode( | |
| 8363 catch_pos, | |
| 8364 new(Z) LoadLocalNode(catch_pos, stack_trace_param.var), | |
| 8365 Library::PrivateCoreLibName(Symbols::_setupFullStackTrace()), | |
| 8366 no_args)); | |
| 8367 } | 8355 } |
| 8368 | 8356 |
| 8369 // Add nested block with user-defined code. This blocks allows | 8357 // Add nested block with user-defined code. This blocks allows |
| 8370 // declarations in the body to shadow the catch parameters. | 8358 // declarations in the body to shadow the catch parameters. |
| 8371 CheckToken(Token::kLBRACE); | 8359 CheckToken(Token::kLBRACE); |
| 8372 | 8360 |
| 8373 // In case of async closures we need to restore the saved try index of an | 8361 // In case of async closures we need to restore the saved try index of an |
| 8374 // outer try block (if it exists). | 8362 // outer try block (if it exists). |
| 8375 ASSERT(try_blocks_list_ != NULL); | 8363 ASSERT(try_blocks_list_ != NULL); |
| 8376 if (innermost_function().IsAsyncClosure() || | 8364 if (innermost_function().IsAsyncClosure() || |
| (...skipping 4188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12565 void Parser::SkipQualIdent() { | 12553 void Parser::SkipQualIdent() { |
| 12566 ASSERT(IsIdentifier()); | 12554 ASSERT(IsIdentifier()); |
| 12567 ConsumeToken(); | 12555 ConsumeToken(); |
| 12568 if (CurrentToken() == Token::kPERIOD) { | 12556 if (CurrentToken() == Token::kPERIOD) { |
| 12569 ConsumeToken(); // Consume the kPERIOD token. | 12557 ConsumeToken(); // Consume the kPERIOD token. |
| 12570 ExpectIdentifier("identifier expected after '.'"); | 12558 ExpectIdentifier("identifier expected after '.'"); |
| 12571 } | 12559 } |
| 12572 } | 12560 } |
| 12573 | 12561 |
| 12574 } // namespace dart | 12562 } // namespace dart |
| OLD | NEW |