Chromium Code Reviews| Index: sdk/lib/_internal/compiler/js_lib/js_helper.dart |
| diff --git a/sdk/lib/_internal/compiler/js_lib/js_helper.dart b/sdk/lib/_internal/compiler/js_lib/js_helper.dart |
| index f964d399789596eb256b995c627161e682491f74..48d4b606e170ae0edc8a730144cefb5a9abc8aa1 100644 |
| --- a/sdk/lib/_internal/compiler/js_lib/js_helper.dart |
| +++ b/sdk/lib/_internal/compiler/js_lib/js_helper.dart |
| @@ -3550,26 +3550,26 @@ Function _wrapJsFunctionForThenHelper(dynamic /* js function */ function, |
| /// |
| /// If [helperCallback] or [errorCallback] throws the error is added to the |
| /// stream. |
| -dynamic streamHelper(dynamic object, |
| +streamHelper(dynamic object, |
|
floitsch
2015/02/10 13:27:50
Apparently this is now a void function.
Mark it as
sigurdm
2015/02/10 13:35:52
Done.
|
| dynamic /* js function */ helperCallback, |
| AsyncStarStreamController controller, |
| dynamic /* js function */ errorCallback) { |
| if (helperCallback == null) { |
| // This happens on return from the async* function. |
| controller.close(); |
| - return null; |
| + return; |
| } |
| if (object is IterationMarker) { |
| if (controller.stopRunning) { |
| _wrapJsFunctionForStream(errorCallback, controller)(); |
| - return null; |
| + return; |
| } |
| if (object.state == IterationMarker.YIELD_SINGLE) { |
| controller.add(object.value); |
| // If the controller is paused we stop producing more values. |
| if (controller.isPaused) { |
| - return null; |
| + return; |
| } |
| // TODO(sigurdm): We should not suspend here according to the spec. |
| scheduleMicrotask(() { |
| @@ -3586,7 +3586,7 @@ dynamic streamHelper(dynamic object, |
| controller.isAdding = false; |
| _wrapJsFunctionForStream(helperCallback, controller)(null); |
| }); |
| - return null; |
| + return; |
| } |
| } |
| @@ -3595,6 +3595,9 @@ dynamic streamHelper(dynamic object, |
| onError: errorCallback == null |
| ? null |
| : _wrapJsFunctionForStream(errorCallback, controller)); |
| +} |
| + |
| +Stream streamOfController(AsyncStarStreamController controller) { |
| return controller.stream; |
| } |
| @@ -3618,6 +3621,14 @@ class AsyncStarStreamController { |
| AsyncStarStreamController(helperCallback) { |
| controller = new StreamController( |
| + onListen: () { |
| + scheduleMicrotask(() => JS('', '#(null)', helperCallback)); |
| + }, |
| + onPause: () { |
| + if (!isAdding) { |
| + streamHelper(null, helperCallback, this, null); |
|
floitsch
2015/02/10 13:27:50
Why do we need to call the streamHelper when we ar
sigurdm
2015/02/10 13:35:52
Yes, this is wrong - we should not do anything onP
|
| + } |
| + }, |
| onResume: () { |
| if (!isAdding) { |
| streamHelper(null, helperCallback, this, null); |