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

Unified Diff: runtime/vm/ast.h

Issue 634603002: Await always waits (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | runtime/vm/ast_printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/ast.h
===================================================================
--- runtime/vm/ast.h (revision 41104)
+++ runtime/vm/ast.h (working copy)
@@ -170,41 +170,26 @@
// AwaitMarker nodes are used to generate markers that the FlowGraphBuilder
-// relies on. They can occur in two kinds:
-// 1) kNewContinuationState: A marker indicating that a new await state needs to
-// be added to a function preamble. This type also triggers storing of the
-// current context.
-// 2) kTargetForContinuation: A marker indicating an entry point for the most
-// recent generated state.
+// relies on. A marker indicates that a new await state needs to be
+// added to a function preamble. This type also triggers storing of the
+// current context.
//
-// In general it is expected (ASSERT) that the different kinds of markers reach
-// the FlowGraphBuilder in alternating order. That is:
-// <new state> -> <other nodes> -> <target> -> <other nodes> ->
-// <new state> -> ...
+// It is expected (ASSERT) that an AwaitMarker is followed by
+// a return node of kind kContinuationTarget. That is:
+// <AwaitMarker> -> <other nodes> -> <kContinuationTarget> -> <other nodes> ->
+// <AwaitMarker> -> ...
class AwaitMarkerNode : public AstNode {
public:
- enum MarkerType {
- kNewContinuationState,
- kTargetForContinuation,
- };
+ AwaitMarkerNode() : AstNode(Scanner::kNoSourcePos) { }
- explicit AwaitMarkerNode(MarkerType marker_type)
- : AstNode(Scanner::kNoSourcePos),
- marker_type_(marker_type) { }
-
void VisitChildren(AstNodeVisitor* visitor) const { }
- MarkerType marker_type() const {
- return marker_type_;
- }
-
LocalScope* scope() const { return scope_; }
void set_scope(LocalScope* scope) { scope_ = scope; }
DECLARE_COMMON_NODE_FUNCTIONS(AwaitMarkerNode);
private:
- MarkerType marker_type_;
LocalScope* scope_;
DISALLOW_COPY_AND_ASSIGN(AwaitMarkerNode);
@@ -579,16 +564,22 @@
DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode);
};
-// Return nodes can be of different types:
-// * A regular return node that in the case of async functions gets replaced
-// with appropriate completer calls. This kind is generated by dart code.
-// * A continuation return that just returns from a function. This kind is
-// generated by AST transformers.
+// In asynchronous code that gets suspeded and resumed, return nodes
+// can be of different types:
+// * A regular return node that in the case of async functions
+// gets replaced with appropriate completer calls. (kRegular)
+// * A continuation return that just returns from a function, without
+// completing the Future. (kContinuation)
+// * A continuation return followed by a continuation target, i.e. the
+// location at which the closure resumes the next time it gets invoked.
+// (kContinuationTarget).
+// In synchronous functions, return nodes are always of type'kRegular'
class ReturnNode : public AstNode {
public:
enum ReturnType {
kRegular,
kContinuation,
+ kContinuationTarget
};
// Return from a void function returns the null object.
« no previous file with comments | « no previous file | runtime/vm/ast_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698