| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 values[pos] = value; | 132 values[pos] = value; |
| 133 remaining--; | 133 remaining--; |
| 134 if (remaining == 0) { | 134 if (remaining == 0) { |
| 135 completer.complete(values); | 135 completer.complete(values); |
| 136 } | 136 } |
| 137 }); | 137 }); |
| 138 } | 138 } |
| 139 if (remaining == 0) { | 139 if (remaining == 0) { |
| 140 return new Future.immediate(const []); | 140 return new Future.immediate(const []); |
| 141 } | 141 } |
| 142 values = new List.fixedLength(remaining); | 142 values = new List(remaining); |
| 143 completer = new Completer<List>(); | 143 completer = new Completer<List>(); |
| 144 return completer.future; | 144 return completer.future; |
| 145 } | 145 } |
| 146 | 146 |
| 147 Future then(f(T value), { onError(AsyncError error) }) { | 147 Future then(f(T value), { onError(AsyncError error) }) { |
| 148 if (!_isComplete) { | 148 if (!_isComplete) { |
| 149 if (onError == null) { | 149 if (onError == null) { |
| 150 return new _ThenFuture(f).._subscribeTo(this); | 150 return new _ThenFuture(f).._subscribeTo(this); |
| 151 } | 151 } |
| 152 return new _SubscribeFuture(f, onError).._subscribeTo(this); | 152 return new _SubscribeFuture(f, onError).._subscribeTo(this); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 Future catchError(function(AsyncError error), {bool test(var error)}) { | 524 Future catchError(function(AsyncError error), {bool test(var error)}) { |
| 525 return _future.catchError(function, test: test); | 525 return _future.catchError(function, test: test); |
| 526 } | 526 } |
| 527 | 527 |
| 528 Future<T> whenComplete(action()) { | 528 Future<T> whenComplete(action()) { |
| 529 return _future.whenComplete(action); | 529 return _future.whenComplete(action); |
| 530 } | 530 } |
| 531 | 531 |
| 532 Stream<T> asStream() => new Stream.fromFuture(_future); | 532 Stream<T> asStream() => new Stream.fromFuture(_future); |
| 533 } | 533 } |
| OLD | NEW |