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 22 matching lines...) Expand all Loading... |
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, | 42 AwaitTransformer(SequenceNode* preamble, |
43 const Library& library, | |
44 ParsedFunction* const parsed_function, | 43 ParsedFunction* const parsed_function, |
45 LocalScope* function_top); | 44 LocalScope* function_top); |
46 | 45 |
47 #define DECLARE_VISIT(BaseName) \ | 46 #define DECLARE_VISIT(BaseName) \ |
48 virtual void Visit##BaseName##Node(BaseName##Node* node); | 47 virtual void Visit##BaseName##Node(BaseName##Node* node); |
49 | 48 |
50 FOR_EACH_NODE(DECLARE_VISIT) | 49 FOR_EACH_NODE(DECLARE_VISIT) |
51 #undef DECLARE_VISIT | 50 #undef DECLARE_VISIT |
52 | 51 |
53 AstNode* Transform(AstNode* expr); | 52 AstNode* Transform(AstNode* expr); |
54 | 53 |
55 private: | 54 private: |
56 LocalVariable* EnsureCurrentTempVar(); | 55 LocalVariable* EnsureCurrentTempVar(); |
57 LocalVariable* AddToPreambleNewTempVar(AstNode* node); | 56 LocalVariable* AddToPreambleNewTempVar(AstNode* node); |
58 ArgumentListNode* TransformArguments(ArgumentListNode* node); | 57 ArgumentListNode* TransformArguments(ArgumentListNode* node); |
59 AstNode* LazyTransform(const Token::Kind kind, | 58 AstNode* LazyTransform(const Token::Kind kind, |
60 AstNode* new_left, | 59 AstNode* new_left, |
61 AstNode* right); | 60 AstNode* right); |
62 LocalScope* ChainNewScope(LocalScope* parent); | 61 LocalScope* ChainNewScope(LocalScope* parent); |
63 LocalVariable* GetVariableInScope(LocalScope* scope, const String& symbol); | 62 LocalVariable* GetVariableInScope(LocalScope* scope, const String& symbol); |
64 | 63 |
65 void NextTempVar() { temp_cnt_++; } | 64 void NextTempVar() { temp_cnt_++; } |
66 | 65 |
67 Isolate* isolate() const { return isolate_; } | 66 Isolate* isolate() const { return isolate_; } |
68 | 67 |
69 SequenceNode* preamble_; | 68 SequenceNode* preamble_; |
70 int32_t temp_cnt_; | 69 int32_t temp_cnt_; |
71 AstNode* result_; | 70 AstNode* result_; |
72 const Library& library_; | |
73 ParsedFunction* const parsed_function_; | 71 ParsedFunction* const parsed_function_; |
74 LocalScope* function_top_; | 72 LocalScope* function_top_; |
75 | 73 |
76 Isolate* isolate_; | 74 Isolate* isolate_; |
77 | 75 |
78 DISALLOW_COPY_AND_ASSIGN(AwaitTransformer); | 76 DISALLOW_COPY_AND_ASSIGN(AwaitTransformer); |
79 }; | 77 }; |
80 | 78 |
81 } // namespace dart | 79 } // namespace dart |
82 | 80 |
83 #endif // VM_AST_TRANSFORMER_H_ | 81 #endif // VM_AST_TRANSFORMER_H_ |
OLD | NEW |