OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 #ifndef VM_AST_TRANSFORMER_H_ | |
6 #define VM_AST_TRANSFORMER_H_ | |
7 | |
8 #include "platform/assert.h" | |
9 #include "vm/ast.h" | |
10 | |
11 namespace dart { | |
12 | |
13 class ParsedFunction; | |
14 | |
15 class AwaitTransformer : public AstNodeVisitor { | |
16 public: | |
17 explicit AwaitTransformer(SequenceNode* preamble, | |
18 const Library& library, | |
19 ParsedFunction* const parsed_function) | |
20 : preamble_(preamble), | |
21 temp_cnt_(0), | |
22 library_(library), | |
23 parsed_function_(parsed_function) {} | |
24 | |
25 #define DECLARE_VISIT(BaseName) \ | |
26 virtual void Visit##BaseName##Node(BaseName##Node* node); | |
27 | |
28 FOR_EACH_NODE(DECLARE_VISIT) | |
29 #undef DECLARE_VISIT | |
30 | |
31 void Transform(AstNode* expr); | |
32 AstNode* Result() const { return result_; } | |
33 | |
34 private: | |
35 LocalVariable* EnsureCurrentTempVar(); | |
36 LocalVariable* AddToPreambleNewTempVar(AstNode* node); | |
37 ArgumentListNode* TransformArguments(ArgumentListNode* node); | |
38 AstNode* LazyTransform(const Token::Kind kind, | |
39 AstNode* new_left, | |
40 AstNode* right); | |
41 | |
42 void NextTempVar() { temp_cnt_++; } | |
43 | |
44 SequenceNode* preamble_; | |
45 intptr_t temp_cnt_; | |
hausner
2014/08/07 21:48:43
Can we make temp_cnt_ an int instead of intptr_t?
Michael Lippautz (Google)
2014/08/08 18:12:17
Done.
| |
46 AstNode* result_; | |
47 const Library& library_; | |
48 ParsedFunction* const parsed_function_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(AwaitTransformer); | |
51 }; | |
52 | |
53 } // namespace dart | |
54 | |
55 #endif // VM_AST_TRANSFORMER_H_ | |
OLD | NEW |