| 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 | 8 #ifndef DART_PRECOMPILED |
| 9 | 9 |
| 10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 6269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6280 ArgumentListNode* no_args = | 6280 ArgumentListNode* no_args = |
| 6281 new(Z) ArgumentListNode(Scanner::kNoSourcePos); | 6281 new(Z) ArgumentListNode(Scanner::kNoSourcePos); |
| 6282 current_block_->statements->Add( | 6282 current_block_->statements->Add( |
| 6283 new(Z) InstanceCallNode(try_end_pos, | 6283 new(Z) InstanceCallNode(try_end_pos, |
| 6284 new(Z) LoadLocalNode(Scanner::kNoSourcePos, controller), | 6284 new(Z) LoadLocalNode(Scanner::kNoSourcePos, controller), |
| 6285 Symbols::Close(), | 6285 Symbols::Close(), |
| 6286 no_args)); | 6286 no_args)); |
| 6287 | 6287 |
| 6288 // Suspend after the close. | 6288 // Suspend after the close. |
| 6289 AwaitMarkerNode* await_marker = | 6289 AwaitMarkerNode* await_marker = |
| 6290 new(Z) AwaitMarkerNode(async_temp_scope_, current_block_->scope); | 6290 new(Z) AwaitMarkerNode(async_temp_scope_, |
| 6291 current_block_->scope, |
| 6292 Scanner::kNoSourcePos); |
| 6291 current_block_->statements->Add(await_marker); | 6293 current_block_->statements->Add(await_marker); |
| 6292 ReturnNode* continuation_ret = new(Z) ReturnNode(try_end_pos); | 6294 ReturnNode* continuation_ret = new(Z) ReturnNode(try_end_pos); |
| 6293 continuation_ret->set_return_type(ReturnNode::kContinuationTarget); | 6295 continuation_ret->set_return_type(ReturnNode::kContinuationTarget); |
| 6294 current_block_->statements->Add(continuation_ret); | 6296 current_block_->statements->Add(continuation_ret); |
| 6295 | 6297 |
| 6296 finally_clause = CloseBlock(); | 6298 finally_clause = CloseBlock(); |
| 6297 AstNode* node_to_inline = try_statement->GetNodeToInlineFinally(node_index); | 6299 AstNode* node_to_inline = try_statement->GetNodeToInlineFinally(node_index); |
| 6298 if (node_to_inline != NULL) { | 6300 if (node_to_inline != NULL) { |
| 6299 InlinedFinallyNode* node = | 6301 InlinedFinallyNode* node = |
| 6300 new(Z) InlinedFinallyNode(try_end_pos, | 6302 new(Z) InlinedFinallyNode(try_end_pos, |
| (...skipping 3515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9816 if (is_yield_each) { | 9818 if (is_yield_each) { |
| 9817 // Generate :iterator.isYieldEach = true; | 9819 // Generate :iterator.isYieldEach = true; |
| 9818 AstNode* set_is_yield_each = | 9820 AstNode* set_is_yield_each = |
| 9819 new(Z) InstanceSetterNode(Scanner::kNoSourcePos, | 9821 new(Z) InstanceSetterNode(Scanner::kNoSourcePos, |
| 9820 iterator, | 9822 iterator, |
| 9821 String::ZoneHandle(Symbols::IsYieldEach().raw()), | 9823 String::ZoneHandle(Symbols::IsYieldEach().raw()), |
| 9822 new(Z) LiteralNode(TokenPos(), Bool::True())); | 9824 new(Z) LiteralNode(TokenPos(), Bool::True())); |
| 9823 yield->AddNode(set_is_yield_each); | 9825 yield->AddNode(set_is_yield_each); |
| 9824 } | 9826 } |
| 9825 AwaitMarkerNode* await_marker = | 9827 AwaitMarkerNode* await_marker = |
| 9826 new(Z) AwaitMarkerNode(async_temp_scope_, current_block_->scope); | 9828 new(Z) AwaitMarkerNode(async_temp_scope_, |
| 9829 current_block_->scope, |
| 9830 Scanner::kNoSourcePos); |
| 9827 yield->AddNode(await_marker); | 9831 yield->AddNode(await_marker); |
| 9828 // Return true to indicate that a value has been generated. | 9832 // Return true to indicate that a value has been generated. |
| 9829 ReturnNode* return_true = new(Z) ReturnNode(yield_pos, | 9833 ReturnNode* return_true = new(Z) ReturnNode(yield_pos, |
| 9830 new(Z) LiteralNode(TokenPos(), Bool::True())); | 9834 new(Z) LiteralNode(TokenPos(), Bool::True())); |
| 9831 return_true->set_return_type(ReturnNode::kContinuationTarget); | 9835 return_true->set_return_type(ReturnNode::kContinuationTarget); |
| 9832 yield->AddNode(return_true); | 9836 yield->AddNode(return_true); |
| 9833 | 9837 |
| 9834 // If this expression is part of a try block, also append the code for | 9838 // If this expression is part of a try block, also append the code for |
| 9835 // restoring the saved try context that lives on the stack and possibly the | 9839 // restoring the saved try context that lives on the stack and possibly the |
| 9836 // saved try context of the outer try block. | 9840 // saved try context of the outer try block. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9884 SequenceNode* true_branch = | 9888 SequenceNode* true_branch = |
| 9885 new(Z) SequenceNode(Scanner::kNoSourcePos, NULL); | 9889 new(Z) SequenceNode(Scanner::kNoSourcePos, NULL); |
| 9886 AstNode* return_from_generator = new(Z) ReturnNode(yield_pos); | 9890 AstNode* return_from_generator = new(Z) ReturnNode(yield_pos); |
| 9887 true_branch->Add(return_from_generator); | 9891 true_branch->Add(return_from_generator); |
| 9888 AddNodeForFinallyInlining(return_from_generator); | 9892 AddNodeForFinallyInlining(return_from_generator); |
| 9889 AstNode* if_is_cancelled = | 9893 AstNode* if_is_cancelled = |
| 9890 new(Z) IfNode(Scanner::kNoSourcePos, add_call, true_branch, NULL); | 9894 new(Z) IfNode(Scanner::kNoSourcePos, add_call, true_branch, NULL); |
| 9891 yield->AddNode(if_is_cancelled); | 9895 yield->AddNode(if_is_cancelled); |
| 9892 | 9896 |
| 9893 AwaitMarkerNode* await_marker = | 9897 AwaitMarkerNode* await_marker = |
| 9894 new(Z) AwaitMarkerNode(async_temp_scope_, current_block_->scope); | 9898 new(Z) AwaitMarkerNode(async_temp_scope_, |
| 9899 current_block_->scope, |
| 9900 Scanner::kNoSourcePos); |
| 9895 yield->AddNode(await_marker); | 9901 yield->AddNode(await_marker); |
| 9896 ReturnNode* continuation_return = new(Z) ReturnNode(yield_pos); | 9902 ReturnNode* continuation_return = new(Z) ReturnNode(yield_pos); |
| 9897 continuation_return->set_return_type(ReturnNode::kContinuationTarget); | 9903 continuation_return->set_return_type(ReturnNode::kContinuationTarget); |
| 9898 yield->AddNode(continuation_return); | 9904 yield->AddNode(continuation_return); |
| 9899 | 9905 |
| 9900 // If this expression is part of a try block, also append the code for | 9906 // If this expression is part of a try block, also append the code for |
| 9901 // restoring the saved try context that lives on the stack and possibly the | 9907 // restoring the saved try context that lives on the stack and possibly the |
| 9902 // saved try context of the outer try block. | 9908 // saved try context of the outer try block. |
| 9903 LocalVariable* saved_try_ctx; | 9909 LocalVariable* saved_try_ctx; |
| 9904 LocalVariable* async_saved_try_ctx; | 9910 LocalVariable* async_saved_try_ctx; |
| (...skipping 4485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14390 const ArgumentListNode& function_args, | 14396 const ArgumentListNode& function_args, |
| 14391 const LocalVariable* temp_for_last_arg, | 14397 const LocalVariable* temp_for_last_arg, |
| 14392 bool is_super_invocation) { | 14398 bool is_super_invocation) { |
| 14393 UNREACHABLE(); | 14399 UNREACHABLE(); |
| 14394 return NULL; | 14400 return NULL; |
| 14395 } | 14401 } |
| 14396 | 14402 |
| 14397 } // namespace dart | 14403 } // namespace dart |
| 14398 | 14404 |
| 14399 #endif // DART_PRECOMPILED | 14405 #endif // DART_PRECOMPILED |
| OLD | NEW |