Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Unified Diff: runtime/vm/ast_transformer.h

Issue 447003003: Introduce await (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698