| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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/ast_transformer.h" | 5 #include "vm/ast_transformer.h" |
| 6 | 6 |
| 7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
| 8 #include "vm/parser.h" | 8 #include "vm/parser.h" |
| 9 #include "vm/thread.h" | 9 #include "vm/thread.h" |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 | 57 |
| 58 AstNode* AwaitTransformer::Transform(AstNode* expr) { | 58 AstNode* AwaitTransformer::Transform(AstNode* expr) { |
| 59 expr->Visit(this); | 59 expr->Visit(this); |
| 60 return result_; | 60 return result_; |
| 61 } | 61 } |
| 62 | 62 |
| 63 | 63 |
| 64 LocalVariable* AwaitTransformer::EnsureCurrentTempVar() { | 64 LocalVariable* AwaitTransformer::EnsureCurrentTempVar() { |
| 65 String& symbol = String::ZoneHandle(Z, String::NewFormatted("%d", temp_cnt_)); | 65 String& symbol = |
| 66 String::ZoneHandle(Z, Symbols::NewFormatted("%d", temp_cnt_)); |
| 66 symbol = Symbols::FromConcat(Symbols::AwaitTempVarPrefix(), symbol); | 67 symbol = Symbols::FromConcat(Symbols::AwaitTempVarPrefix(), symbol); |
| 67 ASSERT(!symbol.IsNull()); | 68 ASSERT(!symbol.IsNull()); |
| 68 // Look up the variable in the scope used for async temp variables. | 69 // Look up the variable in the scope used for async temp variables. |
| 69 LocalVariable* await_tmp = async_temp_scope_->LocalLookupVariable(symbol); | 70 LocalVariable* await_tmp = async_temp_scope_->LocalLookupVariable(symbol); |
| 70 if (await_tmp == NULL) { | 71 if (await_tmp == NULL) { |
| 71 // We need a new temp variable; add it to the function's top scope. | 72 // We need a new temp variable; add it to the function's top scope. |
| 72 await_tmp = new (Z) LocalVariable( | 73 await_tmp = new (Z) LocalVariable( |
| 73 Scanner::kNoSourcePos, symbol, Type::ZoneHandle(Type::DynamicType())); | 74 Scanner::kNoSourcePos, symbol, Type::ZoneHandle(Type::DynamicType())); |
| 74 async_temp_scope_->AddVariable(await_tmp); | 75 async_temp_scope_->AddVariable(await_tmp); |
| 75 // After adding it to the top scope, we can look it up from the preamble. | 76 // After adding it to the top scope, we can look it up from the preamble. |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 | 577 |
| 577 | 578 |
| 578 void AwaitTransformer::VisitThrowNode(ThrowNode* node) { | 579 void AwaitTransformer::VisitThrowNode(ThrowNode* node) { |
| 579 AstNode* new_exception = Transform(node->exception()); | 580 AstNode* new_exception = Transform(node->exception()); |
| 580 result_ = new(Z) ThrowNode(node->token_pos(), | 581 result_ = new(Z) ThrowNode(node->token_pos(), |
| 581 new_exception, | 582 new_exception, |
| 582 node->stacktrace()); | 583 node->stacktrace()); |
| 583 } | 584 } |
| 584 | 585 |
| 585 } // namespace dart | 586 } // namespace dart |
| OLD | NEW |