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. |