| OLD | NEW |
| 1 // Copyright 2012 Google Inc. All Rights Reserved. | 1 // Copyright 2012 Google Inc. All Rights Reserved. |
| 2 // Dart core library. | 2 // Dart core library. |
| 3 | 3 |
| 4 class FutureImpl<T> implements Future<T> { | 4 class FutureImpl<T> implements Future<T> { |
| 5 | 5 |
| 6 bool _isComplete = false; | 6 bool _isComplete = false; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Value that was provided to this Future by the Completer | 9 * Value that was provided to this Future by the Completer |
| 10 */ | 10 */ |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 if (_isComplete) { | 152 if (_isComplete) { |
| 153 throw new FutureAlreadyCompleteException(); | 153 throw new FutureAlreadyCompleteException(); |
| 154 } | 154 } |
| 155 _value = value; | 155 _value = value; |
| 156 _complete(); | 156 _complete(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void _setException(Object exception, Object stackTrace) { | 159 void _setException(Object exception, Object stackTrace) { |
| 160 if (exception === null) { | 160 if (exception === null) { |
| 161 // null is not a legal value for the exception of a Future. | 161 // null is not a legal value for the exception of a Future. |
| 162 throw new IllegalArgumentException(null); | 162 throw new ArgumentError(null); |
| 163 } | 163 } |
| 164 if (_isComplete) { | 164 if (_isComplete) { |
| 165 throw new FutureAlreadyCompleteException(); | 165 throw new FutureAlreadyCompleteException(); |
| 166 } | 166 } |
| 167 _exception = exception; | 167 _exception = exception; |
| 168 _stackTrace = stackTrace; | 168 _stackTrace = stackTrace; |
| 169 _complete(); | 169 _complete(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 Future transform(Function transformation) { | 172 Future transform(Function transformation) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } | 261 } |
| 262 | 262 |
| 263 void complete(T value) { | 263 void complete(T value) { |
| 264 _futureImpl._setValue(value); | 264 _futureImpl._setValue(value); |
| 265 } | 265 } |
| 266 | 266 |
| 267 void completeException(Object exception, [Object stackTrace]) { | 267 void completeException(Object exception, [Object stackTrace]) { |
| 268 _futureImpl._setException(exception, stackTrace); | 268 _futureImpl._setException(exception, stackTrace); |
| 269 } | 269 } |
| 270 } | 270 } |
| OLD | NEW |