Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: sdk/lib/async/future_impl.dart

Issue 1815583002: Add generic annotations to more SDK APIs. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove generic type from _Future.then Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sdk/lib/async/stream.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** The onValue and onError handlers return either a value or a future */ 7 /** The onValue and onError handlers return either a value or a future */
8 typedef dynamic _FutureOnValue<T>(T value); 8 typedef dynamic _FutureOnValue<T>(T value);
9 /** Test used by [Future.catchError] to handle skip some errors. */ 9 /** Test used by [Future.catchError] to handle skip some errors. */
10 typedef bool _FutureErrorTest(var error); 10 typedef bool _FutureErrorTest(var error);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 bool get _isChained => _state == _CHAINED; 184 bool get _isChained => _state == _CHAINED;
185 bool get _isComplete => _state >= _VALUE; 185 bool get _isComplete => _state >= _VALUE;
186 bool get _hasError => _state == _ERROR; 186 bool get _hasError => _state == _ERROR;
187 187
188 void _setChained(_Future source) { 188 void _setChained(_Future source) {
189 assert(_mayAddListener); 189 assert(_mayAddListener);
190 _state = _CHAINED; 190 _state = _CHAINED;
191 _resultOrListeners = source; 191 _resultOrListeners = source;
192 } 192 }
193 193
194 Future then(f(T value), { Function onError }) { 194 Future/*<S>*/ then/*<S>*/(f(T value), { Function onError }) {
195 Zone currentZone = Zone.current; 195 Zone currentZone = Zone.current;
196 if (!identical(currentZone, _ROOT_ZONE)) { 196 if (!identical(currentZone, _ROOT_ZONE)) {
197 f = currentZone.registerUnaryCallback(f); 197 f = currentZone.registerUnaryCallback(f);
198 if (onError != null) { 198 if (onError != null) {
199 onError = _registerErrorHandler(onError, currentZone); 199 onError = _registerErrorHandler(onError, currentZone);
200 } 200 }
201 } 201 }
202 return _thenNoZoneRegistration(f, onError); 202 return _thenNoZoneRegistration(f, onError);
203 } 203 }
204 204
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 } 709 }
710 }, onError: (e, s) { 710 }, onError: (e, s) {
711 if (timer.isActive) { 711 if (timer.isActive) {
712 timer.cancel(); 712 timer.cancel();
713 result._completeError(e, s); 713 result._completeError(e, s);
714 } 714 }
715 }); 715 });
716 return result; 716 return result;
717 } 717 }
718 } 718 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/async/stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698