Index: sdk/lib/async/stream_transformers.dart |
diff --git a/sdk/lib/async/stream_transformers.dart b/sdk/lib/async/stream_transformers.dart |
index e54a9324af81c1890094a7a78d6bf8c26f274d24..3f4857707ee4786f55a7fda679ab4f71696fe36e 100644 |
--- a/sdk/lib/async/stream_transformers.dart |
+++ b/sdk/lib/async/stream_transformers.dart |
@@ -209,25 +209,12 @@ class _HandlerEventSink<S, T> implements EventSink<S> { |
final _TransformDoneHandler<T> _handleDone; |
/// The output sink where the handlers should send their data into. |
- EventSink<T> _sink; |
+ final EventSink<T> _sink; |
_HandlerEventSink( |
- this._handleData, this._handleError, this._handleDone, this._sink) { |
- if (_sink == null) { |
- throw new ArgumentError("The provided sink must not be null."); |
- } |
- } |
- |
- bool get _isClosed => _sink == null; |
+ this._handleData, this._handleError, this._handleDone, this._sink); |
void add(S data) { |
- if (_isClosed) { |
- // TODO(29554): throw a StateError, and don't just report the problem. |
- Zone.ROOT |
- ..print("Sink is closed and adding to it is an error.") |
- ..print(" See http://dartbug.com/29554.") |
- ..print(StackTrace.current); |
- } |
if (_handleData != null) { |
_handleData(data, _sink); |
} else { |
@@ -236,13 +223,6 @@ class _HandlerEventSink<S, T> implements EventSink<S> { |
} |
void addError(Object error, [StackTrace stackTrace]) { |
- if (_isClosed) { |
- // TODO(29554): throw a StateError, and don't just report the problem. |
- Zone.ROOT |
- ..print("Sink is closed and adding to it is an error.") |
- ..print(" See http://dartbug.com/29554.") |
- ..print(StackTrace.current); |
- } |
if (_handleError != null) { |
_handleError(error, stackTrace, _sink); |
} else { |
@@ -251,13 +231,10 @@ class _HandlerEventSink<S, T> implements EventSink<S> { |
} |
void close() { |
- if (_isClosed) return; |
- var sink = _sink; |
- _sink = null; |
if (_handleDone != null) { |
- _handleDone(sink); |
+ _handleDone(_sink); |
} else { |
- sink.close(); |
+ _sink.close(); |
} |
} |
} |