| Index: sdk/lib/async/stream_impl.dart
|
| diff --git a/sdk/lib/async/stream_impl.dart b/sdk/lib/async/stream_impl.dart
|
| index ffab312f3c68c27e2e0f8d2b87190e71ed9b259d..7f26c4fba11e9ce85e842d65f78925ce1d73d9e5 100644
|
| --- a/sdk/lib/async/stream_impl.dart
|
| +++ b/sdk/lib/async/stream_impl.dart
|
| @@ -190,13 +190,13 @@ class _BufferingStreamSubscription<T> implements StreamSubscription<T>,
|
| }
|
|
|
| Future asFuture([var futureValue]) {
|
| - _Future<T> result = new _Future<T>();
|
| + _FutureImpl<T> result = new _FutureImpl<T>();
|
|
|
| // Overwrite the onDone and onError handlers.
|
| - _onDone = () { result._complete(futureValue); };
|
| + _onDone = () { result._setValue(futureValue); };
|
| _onError = (error) {
|
| cancel();
|
| - result._completeError(error);
|
| + result._setError(error);
|
| };
|
|
|
| return result;
|
| @@ -716,7 +716,7 @@ class _DummyStreamSubscription<T> implements StreamSubscription<T> {
|
| void cancel() {}
|
| bool get isPaused => _pauseCounter > 0;
|
|
|
| - Future asFuture([futureValue]) => new _Future();
|
| + Future asFuture([futureValue]) => new _FutureImpl();
|
| }
|
|
|
| class _AsBroadcastStream<T> extends Stream<T> {
|
| @@ -917,14 +917,14 @@ class _StreamIteratorImpl<T> implements StreamIterator<T> {
|
|
|
| Future<bool> moveNext() {
|
| if (_state == _STATE_DONE) {
|
| - return new _Future<bool>.immediate(false);
|
| + return new _FutureImpl<bool>.immediate(false);
|
| }
|
| if (_state == _STATE_MOVING) {
|
| throw new StateError("Already waiting for next.");
|
| }
|
| if (_state == _STATE_FOUND) {
|
| _state = _STATE_MOVING;
|
| - _futureOrPrefetch = new _Future<bool>();
|
| + _futureOrPrefetch = new _FutureImpl<bool>();
|
| return _futureOrPrefetch;
|
| } else {
|
| assert(_state >= _STATE_EXTRA_DATA);
|
| @@ -934,14 +934,14 @@ class _StreamIteratorImpl<T> implements StreamIterator<T> {
|
| _current = _futureOrPrefetch;
|
| _futureOrPrefetch = null;
|
| _subscription.resume();
|
| - return new _Future<bool>.immediate(true);
|
| + return new _FutureImpl<bool>.immediate(true);
|
| case _STATE_EXTRA_ERROR:
|
| Object prefetch = _futureOrPrefetch;
|
| _clear();
|
| - return new _Future<bool>.immediateError(prefetch);
|
| + return new _FutureImpl<bool>.immediateError(prefetch);
|
| case _STATE_EXTRA_DONE:
|
| _clear();
|
| - return new _Future<bool>.immediate(false);
|
| + return new _FutureImpl<bool>.immediate(false);
|
| }
|
| }
|
| }
|
| @@ -957,9 +957,9 @@ class _StreamIteratorImpl<T> implements StreamIterator<T> {
|
| void cancel() {
|
| StreamSubscription subscription = _subscription;
|
| if (_state == _STATE_MOVING) {
|
| - _Future<bool> hasNext = _futureOrPrefetch;
|
| + _FutureImpl<bool> hasNext = _futureOrPrefetch;
|
| _clear();
|
| - hasNext._complete(false);
|
| + hasNext._setValue(false);
|
| } else {
|
| _clear();
|
| }
|
| @@ -969,10 +969,10 @@ class _StreamIteratorImpl<T> implements StreamIterator<T> {
|
| void _onData(T data) {
|
| if (_state == _STATE_MOVING) {
|
| _current = data;
|
| - _Future<bool> hasNext = _futureOrPrefetch;
|
| + _FutureImpl<bool> hasNext = _futureOrPrefetch;
|
| _futureOrPrefetch = null;
|
| _state = _STATE_FOUND;
|
| - hasNext._complete(true);
|
| + hasNext._setValue(true);
|
| return;
|
| }
|
| _subscription.pause();
|
| @@ -983,10 +983,10 @@ class _StreamIteratorImpl<T> implements StreamIterator<T> {
|
|
|
| void _onError(Object error) {
|
| if (_state == _STATE_MOVING) {
|
| - _Future<bool> hasNext = _futureOrPrefetch;
|
| + _FutureImpl<bool> hasNext = _futureOrPrefetch;
|
| // We have cancelOnError: true, so the subscription is canceled.
|
| _clear();
|
| - hasNext._completeError(error);
|
| + hasNext._setError(error);
|
| return;
|
| }
|
| _subscription.pause();
|
| @@ -997,9 +997,9 @@ class _StreamIteratorImpl<T> implements StreamIterator<T> {
|
|
|
| void _onDone() {
|
| if (_state == _STATE_MOVING) {
|
| - _Future<bool> hasNext = _futureOrPrefetch;
|
| + _FutureImpl<bool> hasNext = _futureOrPrefetch;
|
| _clear();
|
| - hasNext._complete(false);
|
| + hasNext._setValue(false);
|
| return;
|
| }
|
| _subscription.pause();
|
|
|