Index: pkg/kernel/lib/transformations/continuation.dart |
diff --git a/pkg/kernel/lib/transformations/continuation.dart b/pkg/kernel/lib/transformations/continuation.dart |
index 7f593d17f4efd7aec1278a23b1a6ce42a8f85822..2ba5d0620bbfb81cc7c8ffc56da454bcce1a1f6e 100644 |
--- a/pkg/kernel/lib/transformations/continuation.dart |
+++ b/pkg/kernel/lib/transformations/continuation.dart |
@@ -554,7 +554,7 @@ abstract class AsyncRewriterBase extends ContinuationRewriterBase { |
// ... |
// } |
// } finally { |
- // :for-iterator.cancel(); |
+ // await :for-iterator.cancel(); |
// } |
// } |
var iteratorVariable = new VariableDeclaration(':for-iterator', |
@@ -579,10 +579,9 @@ abstract class AsyncRewriterBase extends ContinuationRewriterBase { |
var tryBody = new WhileStatement(condition, whileBody); |
// iterator.cancel(); |
- var tryFinalizer = new ExpressionStatement(new MethodInvocation( |
- new VariableGet(iteratorVariable), |
- new Name('cancel'), |
- new Arguments(<Expression>[]))); |
+ var tryFinalizer = new ExpressionStatement(new AwaitExpression( |
+ new MethodInvocation(new VariableGet(iteratorVariable), |
+ new Name('cancel'), new Arguments(<Expression>[])))); |
var tryFinally = new TryFinally(tryBody, tryFinalizer); |