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

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

Issue 2208953002: fix #25944, improve Future.then inference (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: cleanup unused code Created 4 years, 4 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
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 /** 7 /**
8 * An object representing a delayed computation. 8 * An object representing a delayed computation.
9 * 9 *
10 * A [Future] is used to represent a potential value, or error, 10 * A [Future] is used to represent a potential value, or error,
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 * the future returned by `then` will be completed with 426 * the future returned by `then` will be completed with
427 * the same result as the future returned by the callback. 427 * the same result as the future returned by the callback.
428 * 428 *
429 * If [onError] is not given, and this future completes with an error, 429 * If [onError] is not given, and this future completes with an error,
430 * the error is forwarded directly to the returned future. 430 * the error is forwarded directly to the returned future.
431 * 431 *
432 * In most cases, it is more readable to use [catchError] separately, possibly 432 * In most cases, it is more readable to use [catchError] separately, possibly
433 * with a `test` parameter, instead of handling both value and error in a 433 * with a `test` parameter, instead of handling both value and error in a
434 * single [then] call. 434 * single [then] call.
435 */ 435 */
436 Future/*<S>*/ then/*<S>*/(/*=S*/ onValue(T value), { Function onError }); 436 Future/*<S>*/ then/*<S>*/(onValue(T value), { Function onError });
Leaf 2016/08/05 22:32:36 Presumably theres are corresponding patch to be co
Jennifer Messerly 2016/08/08 21:59:26 This is the main repo so it changes it here, but y
437 437
438 /** 438 /**
439 * Handles errors emitted by this [Future]. 439 * Handles errors emitted by this [Future].
440 * 440 *
441 * This is the asynchronous equivalent of a "catch" block. 441 * This is the asynchronous equivalent of a "catch" block.
442 * 442 *
443 * Returns a new [Future] that will be completed with either the result of 443 * Returns a new [Future] that will be completed with either the result of
444 * this future or the result of calling the `onError` callback. 444 * this future or the result of calling the `onError` callback.
445 * 445 *
446 * If this future completes with a value, 446 * If this future completes with a value,
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 if (replacement != null) { 756 if (replacement != null) {
757 error = _nonNullError(replacement.error); 757 error = _nonNullError(replacement.error);
758 stackTrace = replacement.stackTrace; 758 stackTrace = replacement.stackTrace;
759 } 759 }
760 result._completeError(error, stackTrace); 760 result._completeError(error, stackTrace);
761 } 761 }
762 762
763 /** Helper function that converts `null` to a [NullThrownError]. */ 763 /** Helper function that converts `null` to a [NullThrownError]. */
764 Object _nonNullError(Object error) => 764 Object _nonNullError(Object error) =>
765 (error != null) ? error : new NullThrownError(); 765 (error != null) ? error : new NullThrownError();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698