Chromium Code Reviews| Index: sdk/lib/io/io_sink.dart |
| diff --git a/sdk/lib/io/io_sink.dart b/sdk/lib/io/io_sink.dart |
| index 351a30bc10301f0e3ff52bc1d71f0b02505abc92..a3310747fcc44447d4e675fbb26b10237840dbc8 100644 |
| --- a/sdk/lib/io/io_sink.dart |
| +++ b/sdk/lib/io/io_sink.dart |
| @@ -62,6 +62,7 @@ class _StreamSinkImpl<T> implements StreamSink<T> { |
| Completer _controllerCompleter; |
| bool _isClosed = false; |
| bool _isBound = false; |
| + bool _hasError = false; |
| _StreamSinkImpl(StreamConsumer<T> this._target) { |
| _doneFuture = _doneCompleter.future; |
| @@ -80,6 +81,7 @@ class _StreamSinkImpl<T> implements StreamSink<T> { |
| throw new StateError("StreamSink is already bound to a stream"); |
| } |
| _isBound = true; |
| + if (_hasError) return done; |
| // Wait for any sync operations to complete. |
| Future targetAddStream() { |
| return _target.addStream(stream) |
| @@ -121,6 +123,7 @@ class _StreamSinkImpl<T> implements StreamSink<T> { |
| if (error == null) { |
| _doneCompleter.complete(value); |
| } else { |
| + _hasError = true; |
|
Bill Hesse
2013/07/01 11:18:05
Do you also want to set hasError in the case that
Anders Johnsen
2013/07/01 11:18:57
No, it's just a guard to avoid us setting it twice
|
| _doneCompleter.completeError(error); |
| } |
| _doneCompleter = null; |