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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 1353843002: dart2js cps: Support sync* and yield. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
index f7d0a79955107e222c6a901133eaff66b2e75b23..44152148716a7d7f89dcd38c424dd8cabb29c78e 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
@@ -86,7 +86,7 @@ abstract class CallExpression extends Expression {
/// An expression without a continuation or a subexpression body.
///
-/// These break straight-line control flow and can be throught of as ending a
+/// These break straight-line control flow and can be thought of as ending a
/// basic block.
abstract class TailExpression extends Expression {
Expression get next => null;
@@ -1261,6 +1261,21 @@ class Await extends CallExpression {
}
}
+class Yield extends CallExpression {
+ final Reference<Primitive> input;
+ final Reference<Continuation> continuation;
+ final bool hasStar;
+
+ Yield(Primitive input, this.hasStar, Continuation continuation)
+ : this.input = new Reference<Primitive>(input),
+ this.continuation = new Reference<Continuation>(continuation);
+
+ @override
+ accept(Visitor visitor) {
+ return visitor.visitYield(this);
+ }
+}
+
List<Reference<Primitive>> _referenceList(Iterable<Primitive> definitions) {
return definitions.map((e) => new Reference<Primitive>(e)).toList();
}
@@ -1293,6 +1308,7 @@ abstract class Visitor<T> {
T visitSetField(SetField node);
T visitUnreachable(Unreachable node);
T visitAwait(Await node);
+ T visitYield(Yield node);
// Definitions.
T visitLiteralList(LiteralList node);
@@ -1602,6 +1618,13 @@ class LeafVisitor implements Visitor {
processReference(node.continuation);
}
+ processYield(Yield node) {}
+ visitYield(Yield node) {
+ processYield(node);
+ processReference(node.input);
+ processReference(node.continuation);
+ }
+
processGetLength(GetLength node) {}
visitGetLength(GetLength node) {
processGetLength(node);
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698