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

Unified Diff: pkg/compiler/lib/src/js/rewrite_async.dart

Issue 926433003: Initialize 'next' variable in async rewrite when using yield in finally blocks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698