| 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 /** | 7 /** |
| 8 * Utility function to attach a stack trace to an [error] if it doesn't have | 8 * Utility function to attach a stack trace to an [error] if it doesn't have |
| 9 * one already. | 9 * one already. |
| 10 */ | 10 */ |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 class _SkipWhileStream<T> extends _ForwardingStream<T, T> { | 407 class _SkipWhileStream<T> extends _ForwardingStream<T, T> { |
| 408 final _Predicate<T> _test; | 408 final _Predicate<T> _test; |
| 409 bool _hasFailed = false; | 409 bool _hasFailed = false; |
| 410 | 410 |
| 411 _SkipWhileStream(Stream<T> source, bool test(T value)) | 411 _SkipWhileStream(Stream<T> source, bool test(T value)) |
| 412 : this._test = test, super(source); | 412 : this._test = test, super(source); |
| 413 | 413 |
| 414 void _handleData(T inputEvent, _EventOutputSink<T> sink) { | 414 void _handleData(T inputEvent, _EventOutputSink<T> sink) { |
| 415 if (_hasFailed) { | 415 if (_hasFailed) { |
| 416 sink._sendData(inputEvent); | 416 sink._sendData(inputEvent); |
| 417 return; |
| 417 } | 418 } |
| 418 bool satisfies; | 419 bool satisfies; |
| 419 try { | 420 try { |
| 420 satisfies = _test(inputEvent); | 421 satisfies = _test(inputEvent); |
| 421 } catch (e, s) { | 422 } catch (e, s) { |
| 422 sink._sendError(_asyncError(e, s)); | 423 sink._sendError(_asyncError(e, s)); |
| 423 // A failure to return a boolean is considered "not matching". | 424 // A failure to return a boolean is considered "not matching". |
| 424 _hasFailed = true; | 425 _hasFailed = true; |
| 425 return; | 426 return; |
| 426 } | 427 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 | 522 |
| 522 void handleError(error, EventSink<T> sink) { | 523 void handleError(error, EventSink<T> sink) { |
| 523 _handleError(error, sink); | 524 _handleError(error, sink); |
| 524 } | 525 } |
| 525 | 526 |
| 526 void handleDone(EventSink<T> sink) { | 527 void handleDone(EventSink<T> sink) { |
| 527 _handleDone(sink); | 528 _handleDone(sink); |
| 528 } | 529 } |
| 529 } | 530 } |
| 530 | 531 |
| OLD | NEW |