File tree 1 file changed +8
-6
lines changed
sdk/lib/_internal/js_runtime/lib
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -407,19 +407,21 @@ void _asyncStarHelper(
407
407
controller.isSuspended = true ;
408
408
return ;
409
409
}
410
- bodyFunction (async_status_codes.SUCCESS , null );
410
+ bodyFunction (
411
+ controller.isCanceled
412
+ ? async_status_codes.STREAM_WAS_CANCELED
413
+ : async_status_codes.SUCCESS ,
414
+ null );
411
415
});
412
416
return ;
413
417
} else if (object.state == _IterationMarker .YIELD_STAR ) {
414
418
Stream stream = object.value;
415
419
// Errors of [stream] are passed though to the main stream. (see
416
420
// [AsyncStreamController.addStream]).
417
- // TODO(sigurdm): The spec is not very clear here. Clarify with Gilad.
418
421
controller.addStream (stream).then ((_) {
419
- // No check for isPaused here because the spec 17.16.2 only
420
- // demands checks *before* each element in [stream] not after the last
421
- // one. On the other hand we check for isCanceled, as that check happens
422
- // after insertion of each element.
422
+ // No need to check for pause because to get here the stream either
423
+ // completed normally or was cancelled. The stream cannot be paused
424
+ // after either of these states.
423
425
int errorCode = controller.isCanceled
424
426
? async_status_codes.STREAM_WAS_CANCELED
425
427
: async_status_codes.SUCCESS ;
You can’t perform that action at this time.
0 commit comments