Await cancellation in the Kernel await transformer

When an an async for loop's StreamIterator is canceled the returned
Future should be awaited.  Closes issue 29192.

BUG=https://github.com/dart-lang/sdk/issues/29192
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2782053003 .
This commit is contained in:
Kevin Millikin 2017-03-29 15:20:19 +02:00
parent 536c610fd2
commit 4de94b2d7b
2 changed files with 4 additions and 6 deletions

View file

@ -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);

View file

@ -3,7 +3,6 @@
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dartk || $compiler == dartkp ]
await_for_test: RuntimeError # Kernel Issue 29192
bad_constructor_test/05: CompileTimeError
bad_initializer1_negative_test: Crash
bad_raw_string_negative_test: Fail