| 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 #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 10218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10229 statement = ParseJump(label_name); | 10229 statement = ParseJump(label_name); |
| 10230 AddNodeForFinallyInlining(statement); | 10230 AddNodeForFinallyInlining(statement); |
| 10231 ExpectSemicolon(); | 10231 ExpectSemicolon(); |
| 10232 } else if (token == Token::kSEMICOLON) { | 10232 } else if (token == Token::kSEMICOLON) { |
| 10233 // Empty statement, nothing to do. | 10233 // Empty statement, nothing to do. |
| 10234 ConsumeToken(); | 10234 ConsumeToken(); |
| 10235 } else if (token == Token::kRETHROW) { | 10235 } else if (token == Token::kRETHROW) { |
| 10236 // Rethrow of current exception. | 10236 // Rethrow of current exception. |
| 10237 ConsumeToken(); | 10237 ConsumeToken(); |
| 10238 ExpectSemicolon(); | 10238 ExpectSemicolon(); |
| 10239 // Check if it is ok to do a rethrow. | 10239 // Check if it is ok to do a rethrow. Find the inntermost enclosing |
| 10240 if ((try_stack_ == NULL) || !try_stack_->inside_catch()) { | 10240 // catch block. |
| 10241 TryStack* try_statement = try_stack_; |
| 10242 while ((try_statement != NULL) && !try_statement->inside_catch()) { |
| 10243 try_statement = try_statement->outer_try(); |
| 10244 } |
| 10245 if (try_statement == NULL) { |
| 10241 ReportError(statement_pos, "rethrow of an exception is not valid here"); | 10246 ReportError(statement_pos, "rethrow of an exception is not valid here"); |
| 10242 } | 10247 } |
| 10243 | 10248 |
| 10244 // If in async code, use :saved_exception_var and :saved_stack_trace_var | 10249 // If in async code, use :saved_exception_var and :saved_stack_trace_var |
| 10245 // instead of :exception_var and :stack_trace_var. | 10250 // instead of :exception_var and :stack_trace_var. |
| 10246 // These variables are bound in the block containing the try. | 10251 // These variables are bound in the block containing the try. |
| 10247 // Look in the try scope directly. | 10252 // Look in the try scope directly. |
| 10248 LocalScope* scope = try_stack_->try_block()->scope->parent(); | 10253 LocalScope* scope = try_statement->try_block()->scope->parent(); |
| 10249 ASSERT(scope != NULL); | 10254 ASSERT(scope != NULL); |
| 10250 LocalVariable* excp_var; | 10255 LocalVariable* excp_var; |
| 10251 LocalVariable* trace_var; | 10256 LocalVariable* trace_var; |
| 10252 if (innermost_function().IsAsyncClosure() || | 10257 if (innermost_function().IsAsyncClosure() || |
| 10253 innermost_function().IsAsyncFunction() || | 10258 innermost_function().IsAsyncFunction() || |
| 10254 innermost_function().IsSyncGenClosure() || | 10259 innermost_function().IsSyncGenClosure() || |
| 10255 innermost_function().IsSyncGenerator() || | 10260 innermost_function().IsSyncGenerator() || |
| 10256 innermost_function().IsAsyncGenClosure() || | 10261 innermost_function().IsAsyncGenClosure() || |
| 10257 innermost_function().IsAsyncGenerator()) { | 10262 innermost_function().IsAsyncGenerator()) { |
| 10258 excp_var = scope->LocalLookupVariable(Symbols::SavedExceptionVar()); | 10263 excp_var = scope->LocalLookupVariable(Symbols::SavedExceptionVar()); |
| (...skipping 4343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14602 const ArgumentListNode& function_args, | 14607 const ArgumentListNode& function_args, |
| 14603 const LocalVariable* temp_for_last_arg, | 14608 const LocalVariable* temp_for_last_arg, |
| 14604 bool is_super_invocation) { | 14609 bool is_super_invocation) { |
| 14605 UNREACHABLE(); | 14610 UNREACHABLE(); |
| 14606 return NULL; | 14611 return NULL; |
| 14607 } | 14612 } |
| 14608 | 14613 |
| 14609 } // namespace dart | 14614 } // namespace dart |
| 14610 | 14615 |
| 14611 #endif // DART_PRECOMPILED_RUNTIME | 14616 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |