Index: runtime/vm/ast_transformer.h |
diff --git a/runtime/vm/ast_transformer.h b/runtime/vm/ast_transformer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4237c224b056ad09ef82fd9ae5bff1d88b02fc7e |
--- /dev/null |
+++ b/runtime/vm/ast_transformer.h |
@@ -0,0 +1,55 @@ |
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+#ifndef VM_AST_TRANSFORMER_H_ |
+#define VM_AST_TRANSFORMER_H_ |
+ |
+#include "platform/assert.h" |
+#include "vm/ast.h" |
+ |
+namespace dart { |
+ |
+class ParsedFunction; |
+ |
+class AwaitTransformer : public AstNodeVisitor { |
+ public: |
+ explicit AwaitTransformer(SequenceNode* preamble, |
+ const Library& library, |
+ ParsedFunction* const parsed_function) |
+ : preamble_(preamble), |
+ temp_cnt_(0), |
+ library_(library), |
+ parsed_function_(parsed_function) {} |
+ |
+#define DECLARE_VISIT(BaseName) \ |
+ virtual void Visit##BaseName##Node(BaseName##Node* node); |
+ |
+ FOR_EACH_NODE(DECLARE_VISIT) |
+#undef DECLARE_VISIT |
+ |
+ void Transform(AstNode* expr); |
+ AstNode* Result() const { return result_; } |
+ |
+ private: |
+ LocalVariable* EnsureCurrentTempVar(); |
+ LocalVariable* AddToPreambleNewTempVar(AstNode* node); |
+ ArgumentListNode* TransformArguments(ArgumentListNode* node); |
+ AstNode* LazyTransform(const Token::Kind kind, |
+ AstNode* new_left, |
+ AstNode* right); |
+ |
+ void NextTempVar() { temp_cnt_++; } |
+ |
+ SequenceNode* preamble_; |
+ 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.
|
+ AstNode* result_; |
+ const Library& library_; |
+ ParsedFunction* const parsed_function_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AwaitTransformer); |
+}; |
+ |
+} // namespace dart |
+ |
+#endif // VM_AST_TRANSFORMER_H_ |