| 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 | 
| 11 namespace dart { | 11 namespace dart { | 
| 12 | 12 | 
|  | 13 // Quick access to the current thread. | 
|  | 14 #define T (thread()) | 
|  | 15 | 
| 13 // Quick access to the current zone. | 16 // Quick access to the current zone. | 
| 14 #define Z (thread()->zone()) | 17 #define Z (thread()->zone()) | 
| 15 | 18 | 
| 16 // Quick synthetic token position. | 19 // Quick synthetic token position. | 
| 17 #define ST(token_pos) ((token_pos).ToSynthetic()) | 20 #define ST(token_pos) ((token_pos).ToSynthetic()) | 
| 18 | 21 | 
| 19 // Nodes that are unreachable from already parsed expressions. | 22 // Nodes that are unreachable from already parsed expressions. | 
| 20 #define FOR_EACH_UNREACHABLE_NODE(V)                                           \ | 23 #define FOR_EACH_UNREACHABLE_NODE(V)                                           \ | 
| 21   V(AwaitMarker)                                                               \ | 24   V(AwaitMarker)                                                               \ | 
| 22   V(Case)                                                                      \ | 25   V(Case)                                                                      \ | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 59 | 62 | 
| 60 | 63 | 
| 61 AstNode* AwaitTransformer::Transform(AstNode* expr) { | 64 AstNode* AwaitTransformer::Transform(AstNode* expr) { | 
| 62   expr->Visit(this); | 65   expr->Visit(this); | 
| 63   return result_; | 66   return result_; | 
| 64 } | 67 } | 
| 65 | 68 | 
| 66 | 69 | 
| 67 LocalVariable* AwaitTransformer::EnsureCurrentTempVar() { | 70 LocalVariable* AwaitTransformer::EnsureCurrentTempVar() { | 
| 68   String& symbol = | 71   String& symbol = | 
| 69       String::ZoneHandle(Z, Symbols::NewFormatted("%d", temp_cnt_)); | 72       String::ZoneHandle(Z, Symbols::NewFormatted(T, "%d", temp_cnt_)); | 
| 70   symbol = Symbols::FromConcat(Symbols::AwaitTempVarPrefix(), symbol); | 73   symbol = Symbols::FromConcat(T, Symbols::AwaitTempVarPrefix(), symbol); | 
| 71   ASSERT(!symbol.IsNull()); | 74   ASSERT(!symbol.IsNull()); | 
| 72   // 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. | 
| 73   LocalVariable* await_tmp = async_temp_scope_->LocalLookupVariable(symbol); | 76   LocalVariable* await_tmp = async_temp_scope_->LocalLookupVariable(symbol); | 
| 74   if (await_tmp == NULL) { | 77   if (await_tmp == NULL) { | 
| 75     // 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. | 
| 76     await_tmp = new(Z) LocalVariable( | 79     await_tmp = new(Z) LocalVariable( | 
| 77         TokenPosition::kNoSource, symbol, Object::dynamic_type()); | 80         TokenPosition::kNoSource, symbol, Object::dynamic_type()); | 
| 78     async_temp_scope_->AddVariable(await_tmp); | 81     async_temp_scope_->AddVariable(await_tmp); | 
| 79     // After adding it to the top scope, we can look it up from the preamble. | 82     // After adding it to the top scope, we can look it up from the preamble. | 
| 80     // The following call includes an ASSERT check. | 83     // The following call includes an ASSERT check. | 
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 571 | 574 | 
| 572 | 575 | 
| 573 void AwaitTransformer::VisitThrowNode(ThrowNode* node) { | 576 void AwaitTransformer::VisitThrowNode(ThrowNode* node) { | 
| 574   AstNode* new_exception = Transform(node->exception()); | 577   AstNode* new_exception = Transform(node->exception()); | 
| 575   result_ = MakeName(new(Z) ThrowNode(node->token_pos(), | 578   result_ = MakeName(new(Z) ThrowNode(node->token_pos(), | 
| 576       new_exception, | 579       new_exception, | 
| 577       node->stacktrace())); | 580       node->stacktrace())); | 
| 578 } | 581 } | 
| 579 | 582 | 
| 580 }  // namespace dart | 583 }  // namespace dart | 
| OLD | NEW | 
|---|