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 void NextTempVar() { temp_cnt_++; } |
| 37 LocalVariable* AddToPreambleNewTempVar(AstNode* node); |
| 38 ArgumentListNode* TransformArguments(ArgumentListNode* node); |
| 39 AstNode* LazyTransform(const Token::Kind kind, |
| 40 AstNode* new_left, |
| 41 AstNode* right); |
| 42 |
| 43 SequenceNode* preamble_; |
| 44 intptr_t temp_cnt_; |
| 45 AstNode* result_; |
| 46 const Library& library_; |
| 47 ParsedFunction* const parsed_function_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(AwaitTransformer); |
| 50 }; |
| 51 |
| 52 } // namespace dart |
| 53 |
| 54 #endif // VM_AST_TRANSFORMER_H_ |
OLD | NEW |