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

Unified Diff: lib/src/codegen/js_metalet.dart

Issue 1207313002: initial sync*, part of #221 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 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: lib/src/codegen/js_metalet.dart
diff --git a/lib/src/codegen/js_metalet.dart b/lib/src/codegen/js_metalet.dart
index daf7215d070df4ec632689f84e0f062ad3755832..87672ea43d8761ec3251b03028ecf83518700c7b 100644
--- a/lib/src/codegen/js_metalet.dart
+++ b/lib/src/codegen/js_metalet.dart
@@ -18,7 +18,7 @@ import 'js_names.dart' show TemporaryId;
/// (let* (x1=expr1, x2=expr2, t=x1[x2]) { x1[x2] = t + 1; t })
///
/// [MetaLet] will simplify itself automatically when [toExpression],
-/// [toStatement], or [toReturn] is called.
+/// [toStatement], [toReturn], or [toYieldStatement] is called.
///
/// * variables used once will be inlined.
/// * if used in a statement context they can emit as blocks.
@@ -112,6 +112,14 @@ class MetaLet extends Expression {
return _finishStatement(statements);
}
+ Block toYieldStatement({bool star: false}) {
+ var statements = body
+ .map((e) =>
+ e == body.last ? e.toYieldStatement(star: star) : e.toStatement())
+ .toList();
+ return _finishStatement(statements);
+ }
+
accept(NodeVisitor visitor) => toExpression().accept(visitor);
void visitChildren(NodeVisitor visitor) {

Powered by Google App Engine
This is Rietveld 408576698