mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:36:59 +00:00
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:
parent
536c610fd2
commit
4de94b2d7b
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue