| Index: runtime/lib/async_patch.dart
|
| diff --git a/runtime/lib/async_patch.dart b/runtime/lib/async_patch.dart
|
| index fdeb5c9ed4188cad3f2f1508265365aa158d01e7..346e50dd7106d389f4397dc71bdaad47ad593d90 100644
|
| --- a/runtime/lib/async_patch.dart
|
| +++ b/runtime/lib/async_patch.dart
|
| @@ -86,7 +86,7 @@ class _AsyncStarStreamController {
|
| scheduleMicrotask(runBody);
|
| }
|
|
|
| - // Adds element to steam, returns true if the caller should terminate
|
| + // Adds element to stream, returns true if the caller should terminate
|
| // execution of the generator.
|
| //
|
| // TODO(hausner): Per spec, the generator should be suspended before
|
| @@ -177,7 +177,12 @@ class _AsyncStarStreamController {
|
| }
|
| if (cancellationCompleter == null) {
|
| cancellationCompleter = new Completer();
|
| - scheduleGenerator();
|
| + // Only resume the generator if it is suspended at a yield.
|
| + // Cancellation does not affect an async generator that is
|
| + // suspended at an await.
|
| + if (isSuspendedAtYield) {
|
| + scheduleGenerator();
|
| + }
|
| }
|
| return cancellationCompleter.future;
|
| }
|
|
|