Index: pkg/compiler/lib/src/js/rewrite_async.dart |
diff --git a/pkg/compiler/lib/src/js/rewrite_async.dart b/pkg/compiler/lib/src/js/rewrite_async.dart |
index 656b1af9d9bdff50e11d41d8c8b1ef0961d644d1..2946e90e121354702c3f54d038dc8872a9b622d0 100644 |
--- a/pkg/compiler/lib/src/js/rewrite_async.dart |
+++ b/pkg/compiler/lib/src/js/rewrite_async.dart |
@@ -790,7 +790,7 @@ class AsyncRewriter extends js.NodeVisitor { |
if (hasTryBlocks) { |
inits.add(makeInit(handlerName, new js.LiteralNull())); |
} |
- if (hasJumpThroughFinally) { |
+ if (hasJumpThroughFinally || analysis.hasYield) { |
inits.add(makeInit(nextName, null)); |
} |
if (analysis.hasExplicitReturns && isAsync) { |
@@ -1753,6 +1753,8 @@ class PreTranslationAnalysis extends js.NodeVisitor<bool> { |
bool hasThis = false; |
+ bool hasYield = false; |
+ |
// The function currently being analyzed. |
js.Fun currentFunction; |
@@ -2143,6 +2145,7 @@ class PreTranslationAnalysis extends js.NodeVisitor<bool> { |
@override |
bool visitDartYield(js.DartYield node) { |
+ hasYield = true; |
visit(node.expression); |
return true; |
} |