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

Unified Diff: runtime/vm/ast.h

Issue 460763002: Fix returning from async functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: update language test status 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
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/ast.h
diff --git a/runtime/vm/ast.h b/runtime/vm/ast.h
index 03d65a06f3561c9161e330c1ec2dadd0a08eb75a..113009fa2e7bd3e79cd5741dc1c0b1b383eb084b 100644
--- a/runtime/vm/ast.h
+++ b/runtime/vm/ast.h
@@ -162,7 +162,7 @@ class SequenceNode : public AstNode {
void VisitChildren(AstNodeVisitor* visitor) const;
- void Add(AstNode* node) { nodes_.Add(node); }
+ void Add(AstNode* node);
intptr_t length() const { return nodes_.length(); }
AstNode* NodeAt(intptr_t index) const { return nodes_[index]; }
void ReplaceNodeAt(intptr_t index, AstNode* value) { nodes_[index] = value; }
@@ -515,6 +515,8 @@ class PrimaryNode : public AstNode {
};
+// TODO(mlippautz): Implement return nodes that are used to return from a
+// continuation.
class ReturnNode : public AstNode {
public:
// Return from a void function returns the null object.
@@ -522,14 +524,16 @@ class ReturnNode : public AstNode {
: AstNode(token_pos),
value_(new LiteralNode(token_pos, Instance::ZoneHandle())),
inlined_finally_list_(),
- saved_return_value_var_(NULL) { }
+ saved_return_value_var_(NULL),
+ is_regular_return_(true) { }
// Return from a non-void function.
ReturnNode(intptr_t token_pos,
AstNode* value)
: AstNode(token_pos),
value_(value),
inlined_finally_list_(),
- saved_return_value_var_(NULL) {
+ saved_return_value_var_(NULL),
+ is_regular_return_(true) {
ASSERT(value_ != NULL);
}
@@ -558,12 +562,20 @@ class ReturnNode : public AstNode {
}
}
+ void set_scope(LocalScope* scope) { scope_ = scope; }
+ LocalScope* scope() const { return scope_; }
+
+ // Returns false if the return node is used to return from a continuation.
+ bool is_regular_return() const { return is_regular_return_; }
+
DECLARE_COMMON_NODE_FUNCTIONS(ReturnNode);
private:
AstNode* value_;
GrowableArray<InlinedFinallyNode*> inlined_finally_list_;
LocalVariable* saved_return_value_var_;
+ LocalScope* scope_;
+ bool is_regular_return_;
DISALLOW_COPY_AND_ASSIGN(ReturnNode);
};
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698