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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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* AddNewTempVarToPreamble(AstNode* node, |
55 TokenPosition token_pos); | 55 TokenPosition token_pos); |
| 56 LoadLocalNode* MakeName(AstNode* node); |
56 ArgumentListNode* TransformArguments(ArgumentListNode* node); | 57 ArgumentListNode* TransformArguments(ArgumentListNode* node); |
57 AstNode* LazyTransform(const Token::Kind kind, | 58 AstNode* LazyTransform(const Token::Kind kind, |
58 AstNode* new_left, | 59 AstNode* new_left, |
59 AstNode* right); | 60 AstNode* right); |
60 LocalScope* ChainNewScope(LocalScope* parent); | 61 LocalScope* ChainNewScope(LocalScope* parent); |
61 LocalVariable* GetVariableInScope(LocalScope* scope, const String& symbol); | 62 LocalVariable* GetVariableInScope(LocalScope* scope, const String& symbol); |
62 | 63 |
63 void NextTempVar() { temp_cnt_++; } | 64 void NextTempVar() { temp_cnt_++; } |
64 | 65 |
65 Thread* thread() const { return thread_; } | 66 Thread* thread() const { return thread_; } |
66 | 67 |
67 SequenceNode* preamble_; | 68 SequenceNode* preamble_; |
68 int32_t temp_cnt_; | 69 int32_t temp_cnt_; |
69 AstNode* result_; | 70 AstNode* result_; |
70 LocalScope* async_temp_scope_; | 71 LocalScope* async_temp_scope_; |
71 | 72 |
72 Thread* thread_; | 73 Thread* thread_; |
73 | 74 |
74 DISALLOW_COPY_AND_ASSIGN(AwaitTransformer); | 75 DISALLOW_COPY_AND_ASSIGN(AwaitTransformer); |
75 }; | 76 }; |
76 | 77 |
77 } // namespace dart | 78 } // namespace dart |
78 | 79 |
79 #endif // VM_AST_TRANSFORMER_H_ | 80 #endif // VM_AST_TRANSFORMER_H_ |
OLD | NEW |