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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 LocalVariable* AwaitTransformer::EnsureCurrentTempVar() { | 64 LocalVariable* AwaitTransformer::EnsureCurrentTempVar() { |
65 String& symbol = | 65 String& symbol = |
66 String::ZoneHandle(Z, Symbols::NewFormatted("%d", temp_cnt_)); | 66 String::ZoneHandle(Z, Symbols::NewFormatted("%d", temp_cnt_)); |
67 symbol = Symbols::FromConcat(Symbols::AwaitTempVarPrefix(), symbol); | 67 symbol = Symbols::FromConcat(Symbols::AwaitTempVarPrefix(), symbol); |
68 ASSERT(!symbol.IsNull()); | 68 ASSERT(!symbol.IsNull()); |
69 // 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. |
70 LocalVariable* await_tmp = async_temp_scope_->LocalLookupVariable(symbol); | 70 LocalVariable* await_tmp = async_temp_scope_->LocalLookupVariable(symbol); |
71 if (await_tmp == NULL) { | 71 if (await_tmp == NULL) { |
72 // 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. |
73 await_tmp = new (Z) LocalVariable( | 73 await_tmp = new (Z) LocalVariable( |
74 Scanner::kNoSourcePos, symbol, Type::ZoneHandle(Type::DynamicType())); | 74 Scanner::kNoSourcePos, symbol, Object::dynamic_type()); |
75 async_temp_scope_->AddVariable(await_tmp); | 75 async_temp_scope_->AddVariable(await_tmp); |
76 // 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. |
77 // The following call includes an ASSERT check. | 77 // The following call includes an ASSERT check. |
78 await_tmp = GetVariableInScope(preamble_->scope(), symbol); | 78 await_tmp = GetVariableInScope(preamble_->scope(), symbol); |
79 } | 79 } |
80 return await_tmp; | 80 return await_tmp; |
81 } | 81 } |
82 | 82 |
83 | 83 |
84 LocalVariable* AwaitTransformer::GetVariableInScope(LocalScope* scope, | 84 LocalVariable* AwaitTransformer::GetVariableInScope(LocalScope* scope, |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 586 |
587 | 587 |
588 void AwaitTransformer::VisitThrowNode(ThrowNode* node) { | 588 void AwaitTransformer::VisitThrowNode(ThrowNode* node) { |
589 AstNode* new_exception = Transform(node->exception()); | 589 AstNode* new_exception = Transform(node->exception()); |
590 result_ = new(Z) ThrowNode(node->token_pos(), | 590 result_ = new(Z) ThrowNode(node->token_pos(), |
591 new_exception, | 591 new_exception, |
592 node->stacktrace()); | 592 node->stacktrace()); |
593 } | 593 } |
594 | 594 |
595 } // namespace dart | 595 } // namespace dart |
OLD | NEW |