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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 LocalVariable* AwaitTransformer::EnsureCurrentTempVar() { | 70 LocalVariable* AwaitTransformer::EnsureCurrentTempVar() { |
71 String& symbol = | 71 String& symbol = |
72 String::ZoneHandle(Z, Symbols::NewFormatted(T, "%d", temp_cnt_)); | 72 String::ZoneHandle(Z, Symbols::NewFormatted(T, "%d", temp_cnt_)); |
73 symbol = Symbols::FromConcat(T, Symbols::AwaitTempVarPrefix(), symbol); | 73 symbol = Symbols::FromConcat(T, Symbols::AwaitTempVarPrefix(), symbol); |
74 ASSERT(!symbol.IsNull()); | 74 ASSERT(!symbol.IsNull()); |
75 // Look up the variable in the scope used for async temp variables. | 75 // Look up the variable in the scope used for async temp variables. |
76 LocalVariable* await_tmp = async_temp_scope_->LocalLookupVariable(symbol); | 76 LocalVariable* await_tmp = async_temp_scope_->LocalLookupVariable(symbol); |
77 if (await_tmp == NULL) { | 77 if (await_tmp == NULL) { |
78 // We need a new temp variable; add it to the function's top scope. | 78 // We need a new temp variable; add it to the function's top scope. |
79 await_tmp = new(Z) LocalVariable( | 79 await_tmp = new(Z) LocalVariable( |
80 TokenPosition::kNoSource, symbol, Object::dynamic_type()); | 80 TokenPosition::kNoSource, |
| 81 TokenPosition::kNoSource, |
| 82 symbol, |
| 83 Object::dynamic_type()); |
81 async_temp_scope_->AddVariable(await_tmp); | 84 async_temp_scope_->AddVariable(await_tmp); |
82 // After adding it to the top scope, we can look it up from the preamble. | 85 // After adding it to the top scope, we can look it up from the preamble. |
83 // The following call includes an ASSERT check. | 86 // The following call includes an ASSERT check. |
84 await_tmp = GetVariableInScope(preamble_->scope(), symbol); | 87 await_tmp = GetVariableInScope(preamble_->scope(), symbol); |
85 } | 88 } |
86 return await_tmp; | 89 return await_tmp; |
87 } | 90 } |
88 | 91 |
89 | 92 |
90 LocalVariable* AwaitTransformer::GetVariableInScope(LocalScope* scope, | 93 LocalVariable* AwaitTransformer::GetVariableInScope(LocalScope* scope, |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 564 |
562 | 565 |
563 void AwaitTransformer::VisitThrowNode(ThrowNode* node) { | 566 void AwaitTransformer::VisitThrowNode(ThrowNode* node) { |
564 AstNode* new_exception = Transform(node->exception()); | 567 AstNode* new_exception = Transform(node->exception()); |
565 result_ = MakeName(new(Z) ThrowNode(node->token_pos(), | 568 result_ = MakeName(new(Z) ThrowNode(node->token_pos(), |
566 new_exception, | 569 new_exception, |
567 node->stacktrace())); | 570 node->stacktrace())); |
568 } | 571 } |
569 | 572 |
570 } // namespace dart | 573 } // namespace dart |
OLD | NEW |