| 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 #ifndef VM_AST_TRANSFORMER_H_ | 5 #ifndef VM_AST_TRANSFORMER_H_ |
| 6 #define VM_AST_TRANSFORMER_H_ | 6 #define VM_AST_TRANSFORMER_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // :result_param = t_1; | 32 // :result_param = t_1; |
| 33 // <continuation logic> | 33 // <continuation logic> |
| 34 // t_2 = :result_param; | 34 // t_2 = :result_param; |
| 35 // t_3 = foo(); | 35 // t_3 = foo(); |
| 36 // t_4 = t_2.operator+(t_3); | 36 // t_4 = t_2.operator+(t_3); |
| 37 // | 37 // |
| 38 // and a resulting expression of a load of t_4. | 38 // and a resulting expression of a load of t_4. |
| 39 // | 39 // |
| 40 class AwaitTransformer : public AstNodeVisitor { | 40 class AwaitTransformer : public AstNodeVisitor { |
| 41 public: | 41 public: |
| 42 AwaitTransformer(SequenceNode* preamble, LocalScope* function_top); | 42 AwaitTransformer(SequenceNode* preamble, LocalScope* async_temp_scope); |
| 43 | 43 |
| 44 #define DECLARE_VISIT(BaseName) \ | 44 #define DECLARE_VISIT(BaseName) \ |
| 45 virtual void Visit##BaseName##Node(BaseName##Node* node); | 45 virtual void Visit##BaseName##Node(BaseName##Node* node); |
| 46 | 46 |
| 47 FOR_EACH_NODE(DECLARE_VISIT) | 47 FOR_EACH_NODE(DECLARE_VISIT) |
| 48 #undef DECLARE_VISIT | 48 #undef DECLARE_VISIT |
| 49 | 49 |
| 50 AstNode* Transform(AstNode* expr); | 50 AstNode* Transform(AstNode* expr); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 LocalVariable* EnsureCurrentTempVar(); | 53 LocalVariable* EnsureCurrentTempVar(); |
| 54 LocalVariable* AddToPreambleNewTempVar(AstNode* node); | 54 LocalVariable* AddToPreambleNewTempVar(AstNode* node); |
| 55 ArgumentListNode* TransformArguments(ArgumentListNode* node); | 55 ArgumentListNode* TransformArguments(ArgumentListNode* node); |
| 56 AstNode* LazyTransform(const Token::Kind kind, | 56 AstNode* LazyTransform(const Token::Kind kind, |
| 57 AstNode* new_left, | 57 AstNode* new_left, |
| 58 AstNode* right); | 58 AstNode* right); |
| 59 LocalScope* ChainNewScope(LocalScope* parent); | 59 LocalScope* ChainNewScope(LocalScope* parent); |
| 60 LocalVariable* GetVariableInScope(LocalScope* scope, const String& symbol); | 60 LocalVariable* GetVariableInScope(LocalScope* scope, const String& symbol); |
| 61 | 61 |
| 62 void NextTempVar() { temp_cnt_++; } | 62 void NextTempVar() { temp_cnt_++; } |
| 63 | 63 |
| 64 Thread* thread() const { return thread_; } | 64 Thread* thread() const { return thread_; } |
| 65 | 65 |
| 66 SequenceNode* preamble_; | 66 SequenceNode* preamble_; |
| 67 int32_t temp_cnt_; | 67 int32_t temp_cnt_; |
| 68 AstNode* result_; | 68 AstNode* result_; |
| 69 LocalScope* function_top_; | 69 LocalScope* async_temp_scope_; |
| 70 | 70 |
| 71 Thread* thread_; | 71 Thread* thread_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(AwaitTransformer); | 73 DISALLOW_COPY_AND_ASSIGN(AwaitTransformer); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace dart | 76 } // namespace dart |
| 77 | 77 |
| 78 #endif // VM_AST_TRANSFORMER_H_ | 78 #endif // VM_AST_TRANSFORMER_H_ |
| OLD | NEW |