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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 AwaitTransformer(SequenceNode* preamble, LocalScope* function_top); | 42 AwaitTransformer(SequenceNode* preamble, LocalScope* function_top); |
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 static AstNode* RestoreSavedTryContext(Zone* zone, | |
53 LocalScope* scope, | |
54 int16_t try_index); | |
55 | |
56 private: | 52 private: |
57 LocalVariable* EnsureCurrentTempVar(); | 53 LocalVariable* EnsureCurrentTempVar(); |
58 LocalVariable* AddToPreambleNewTempVar(AstNode* node); | 54 LocalVariable* AddToPreambleNewTempVar(AstNode* node); |
59 ArgumentListNode* TransformArguments(ArgumentListNode* node); | 55 ArgumentListNode* TransformArguments(ArgumentListNode* node); |
60 AstNode* LazyTransform(const Token::Kind kind, | 56 AstNode* LazyTransform(const Token::Kind kind, |
61 AstNode* new_left, | 57 AstNode* new_left, |
62 AstNode* right); | 58 AstNode* right); |
63 LocalScope* ChainNewScope(LocalScope* parent); | 59 LocalScope* ChainNewScope(LocalScope* parent); |
64 LocalVariable* GetVariableInScope(LocalScope* scope, const String& symbol); | 60 LocalVariable* GetVariableInScope(LocalScope* scope, const String& symbol); |
65 | 61 |
66 void NextTempVar() { temp_cnt_++; } | 62 void NextTempVar() { temp_cnt_++; } |
67 | 63 |
68 Thread* thread() const { return thread_; } | 64 Thread* thread() const { return thread_; } |
69 | 65 |
70 SequenceNode* preamble_; | 66 SequenceNode* preamble_; |
71 int32_t temp_cnt_; | 67 int32_t temp_cnt_; |
72 AstNode* result_; | 68 AstNode* result_; |
73 LocalScope* function_top_; | 69 LocalScope* function_top_; |
74 | 70 |
75 Thread* thread_; | 71 Thread* thread_; |
76 | 72 |
77 DISALLOW_COPY_AND_ASSIGN(AwaitTransformer); | 73 DISALLOW_COPY_AND_ASSIGN(AwaitTransformer); |
78 }; | 74 }; |
79 | 75 |
80 } // namespace dart | 76 } // namespace dart |
81 | 77 |
82 #endif // VM_AST_TRANSFORMER_H_ | 78 #endif // VM_AST_TRANSFORMER_H_ |
OLD | NEW |