| 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 deprecatedFutureValue(_FutureImpl future) => | 7 deprecatedFutureValue(_FutureImpl future) => |
| 8 future._isComplete ? future._resultOrListeners : null; | 8 future._isComplete ? future._resultOrListeners : null; |
| 9 | 9 |
| 10 | 10 |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 } | 354 } |
| 355 | 355 |
| 356 /** The onValue and onError handlers return either a value or a future */ | 356 /** The onValue and onError handlers return either a value or a future */ |
| 357 typedef dynamic _FutureOnValue<T>(T value); | 357 typedef dynamic _FutureOnValue<T>(T value); |
| 358 typedef dynamic _FutureOnError(AsyncError error); | 358 typedef dynamic _FutureOnError(AsyncError error); |
| 359 /** Test used by [Future.catchError] to handle skip some errors. */ | 359 /** Test used by [Future.catchError] to handle skip some errors. */ |
| 360 typedef bool _FutureErrorTest(var error); | 360 typedef bool _FutureErrorTest(var error); |
| 361 /** Used by [WhenFuture]. */ | 361 /** Used by [WhenFuture]. */ |
| 362 typedef void _FutureAction(); | 362 typedef _FutureAction(); |
| 363 | 363 |
| 364 /** Future returned by [Future.then] with no [:onError:] parameter. */ | 364 /** Future returned by [Future.then] with no [:onError:] parameter. */ |
| 365 class _ThenFuture<S, T> extends _TransformFuture<S, T> { | 365 class _ThenFuture<S, T> extends _TransformFuture<S, T> { |
| 366 // TODO(ahe): Restore type when feature is implemented in dart2js | 366 // TODO(ahe): Restore type when feature is implemented in dart2js |
| 367 // checked mode. | 367 // checked mode. |
| 368 final /* _FutureOnValue<S> */ _onValue; | 368 final /* _FutureOnValue<S> */ _onValue; |
| 369 | 369 |
| 370 _ThenFuture(this._onValue); | 370 _ThenFuture(this._onValue); |
| 371 | 371 |
| 372 _sendValue(S value) { | 372 _sendValue(S value) { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 Future catchError(function(AsyncError error), {bool test(var error)}) { | 521 Future catchError(function(AsyncError error), {bool test(var error)}) { |
| 522 return _future.catchError(function, test: test); | 522 return _future.catchError(function, test: test); |
| 523 } | 523 } |
| 524 | 524 |
| 525 Future<T> whenComplete(action()) { | 525 Future<T> whenComplete(action()) { |
| 526 return _future.whenComplete(action); | 526 return _future.whenComplete(action); |
| 527 } | 527 } |
| 528 | 528 |
| 529 Stream<T> asStream() => new Stream.fromFuture(_future); | 529 Stream<T> asStream() => new Stream.fromFuture(_future); |
| 530 } | 530 } |
| OLD | NEW |