Chromium Code Reviews| Index: sdk/lib/async/stream_transformers.dart |
| diff --git a/sdk/lib/async/stream_transformers.dart b/sdk/lib/async/stream_transformers.dart |
| index bfc83d6b58b4befbe215bd641956492567b85380..ff2983ddae0cb11b665225b7c0dd6a2bf145b4e7 100644 |
| --- a/sdk/lib/async/stream_transformers.dart |
| +++ b/sdk/lib/async/stream_transformers.dart |
| @@ -210,11 +210,13 @@ class _HandlerEventSink<S, T> implements EventSink<S> { |
| /// The output sink where the handlers should send their data into. |
| final EventSink<T> _sink; |
|
Lasse Reichstein Nielsen
2017/04/26 08:26:19
Make this field non-final and set it to null when
floitsch
2017/05/01 16:46:25
Done.
|
| + bool _isClosed = false; |
| _HandlerEventSink( |
| this._handleData, this._handleError, this._handleDone, this._sink); |
| void add(S data) { |
| + if (_isClosed) throw new StateError("Sink is closed"); |
| if (_handleData != null) { |
| _handleData(data, _sink); |
| } else { |
| @@ -223,6 +225,7 @@ class _HandlerEventSink<S, T> implements EventSink<S> { |
| } |
| void addError(Object error, [StackTrace stackTrace]) { |
| + if (_isClosed) throw new StateError("Sink is closed"); |
| if (_handleError != null) { |
| _handleError(error, stackTrace, _sink); |
| } else { |
| @@ -231,6 +234,7 @@ class _HandlerEventSink<S, T> implements EventSink<S> { |
| } |
| void close() { |
|
Lasse Reichstein Nielsen
2017/04/26 08:26:19
We should probably bail out here if the sink is al
floitsch
2017/05/01 16:46:25
Realized the same thing.
done.
|
| + _isClosed = true; |
| if (_handleDone != null) { |
| _handleDone(_sink); |
| } else { |