| 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 15 matching lines...) Expand all Loading... |
| 26 _isComplete = true; | 26 _isComplete = true; |
| 27 AsyncError asyncError; | 27 AsyncError asyncError; |
| 28 if (error is AsyncError) { | 28 if (error is AsyncError) { |
| 29 asyncError = error; | 29 asyncError = error; |
| 30 } else { | 30 } else { |
| 31 asyncError = new AsyncError(error, stackTrace); | 31 asyncError = new AsyncError(error, stackTrace); |
| 32 } | 32 } |
| 33 _FutureImpl future = this.future; | 33 _FutureImpl future = this.future; |
| 34 future._setError(asyncError); | 34 future._setError(asyncError); |
| 35 } | 35 } |
| 36 |
| 37 bool get completed => _isComplete; |
| 36 } | 38 } |
| 37 | 39 |
| 38 /** | 40 /** |
| 39 * A listener on a future. | 41 * A listener on a future. |
| 40 * | 42 * |
| 41 * When the future completes, the [_sendValue] or [_sendError] method | 43 * When the future completes, the [_sendValue] or [_sendError] method |
| 42 * is invoked with the result. | 44 * is invoked with the result. |
| 43 * | 45 * |
| 44 * Listeners are kept in a linked list. | 46 * Listeners are kept in a linked list. |
| 45 */ | 47 */ |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 Future catchError(function(AsyncError error), {bool test(var error)}) { | 526 Future catchError(function(AsyncError error), {bool test(var error)}) { |
| 525 return _future.catchError(function, test: test); | 527 return _future.catchError(function, test: test); |
| 526 } | 528 } |
| 527 | 529 |
| 528 Future<T> whenComplete(action()) { | 530 Future<T> whenComplete(action()) { |
| 529 return _future.whenComplete(action); | 531 return _future.whenComplete(action); |
| 530 } | 532 } |
| 531 | 533 |
| 532 Stream<T> asStream() => new Stream.fromFuture(_future); | 534 Stream<T> asStream() => new Stream.fromFuture(_future); |
| 533 } | 535 } |
| OLD | NEW |