Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart.async; | 5 part of dart.async; |
| 6 | 6 |
| 7 /** Utility function to create an [AsyncError] if [error] isn't one already. */ | 7 /** Utility function to create an [AsyncError] if [error] isn't one already. */ |
| 8 AsyncError _asyncError(Object error, Object stackTrace, [AsyncError cause]) { | 8 AsyncError _asyncError(Object error, Object stackTrace, [AsyncError cause]) { |
| 9 if (error is AsyncError) return error; | 9 if (error is AsyncError) return error; |
| 10 if (cause == null) return new AsyncError(error, stackTrace); | 10 if (cause == null) return new AsyncError(error, stackTrace); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 // If the transformation sends a done signal, we stop the subscription. | 162 // If the transformation sends a done signal, we stop the subscription. |
| 163 if (_subscription != null) { | 163 if (_subscription != null) { |
| 164 _subscription.cancel(); | 164 _subscription.cancel(); |
| 165 _subscription = null; | 165 _subscription = null; |
| 166 } | 166 } |
| 167 _onDone(); | 167 _onDone(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 // Methods used as listener on source subscription. | 170 // Methods used as listener on source subscription. |
| 171 | 171 |
| 172 void _handleData(S data) { | 172 // TODO(ahe): Restore type when feature is implemented in dart2js |
| 173 // checked mode. http://dartbug.com/7733 | |
| 174 void _handleData(/*S*/ data) { | |
| 173 _stream._handleData(data, this); | 175 _stream._handleData(data, this); |
| 174 } | 176 } |
| 175 | 177 |
| 176 void _handleError(AsyncError error) { | 178 void _handleError(AsyncError error) { |
|
blois
2013/01/23 18:54:21
Not sure if these should be changed as well, but t
| |
| 177 _stream._handleError(error, this); | 179 _stream._handleError(error, this); |
| 178 } | 180 } |
| 179 | 181 |
| 180 void _handleDone() { | 182 void _handleDone() { |
| 181 _stream._handleDone(this); | 183 _stream._handleDone(this); |
| 182 } | 184 } |
| 183 } | 185 } |
| 184 | 186 |
| 185 // ------------------------------------------------------------------- | 187 // ------------------------------------------------------------------- |
| 186 // Stream transformers used by the default Stream implementation. | 188 // Stream transformers used by the default Stream implementation. |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 500 /** Creates a [StreamSink] from a [_StreamImpl]'s input methods. */ | 502 /** Creates a [StreamSink] from a [_StreamImpl]'s input methods. */ |
| 501 class _StreamImplSink<T> implements StreamSink<T> { | 503 class _StreamImplSink<T> implements StreamSink<T> { |
| 502 _StreamImpl<T> _target; | 504 _StreamImpl<T> _target; |
| 503 _StreamImplSink(this._target); | 505 _StreamImplSink(this._target); |
| 504 void add(T data) { _target._add(data); } | 506 void add(T data) { _target._add(data); } |
| 505 void signalError(AsyncError error) { _target._signalError(error); } | 507 void signalError(AsyncError error) { _target._signalError(error); } |
| 506 void close() { _target._close(); } | 508 void close() { _target._close(); } |
| 507 } | 509 } |
| 508 | 510 |
| 509 | 511 |
| OLD | NEW |