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

Unified Diff: sdk/lib/async/future.dart

Issue 11824032: Make a Future returned by the action of Future.whenCompelete delay. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/async/future_impl.dart » ('j') | sdk/lib/async/future_impl.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/future.dart
diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
index 8a1b200dd82c14d31fdea5bd7d1a80e0219c6995..d91185e47afe6504bced91be3a7550789addf10a 100644
--- a/sdk/lib/async/future.dart
+++ b/sdk/lib/async/future.dart
@@ -102,13 +102,19 @@ abstract class Future<T> {
*
* This is the asynchronous equivalent of a "finally" block.
*
- * If the call to [action] does not throw, the returned future is completed
- * with the same result as this future.
+ * The future returned by this call, [:f:], will complete the same way
+ * as this future unless an error occurs in the [action] call, or in
+ * a [Future] returned by the [action] call. If the [action] call returns
+ * [:null:] (or any non-future value), its return value is ignored.
floitsch 2013/01/09 17:10:13 If the [action] does not return a future its retur
Lasse Reichstein Nielsen 2013/01/10 07:02:33 Done.
*
- * If the call to [action] throws, the returned future is completed with the
+ * If the call to [action] throws, then [:f:] is completed with the
* thrown error.
+ *
+ * If the call to [action] returns a [Future], [:f2:], then completion of
floitsch 2013/01/09 17:10:13 nit: spurious space between "completion" and "of"
Lasse Reichstein Nielsen 2013/01/10 07:02:33 Done.
+ * [:f:] is delayed until [:f2:] completes. If [:f2:] completes with a
floitsch 2013/01/09 17:10:13 completes with an (remove "a").
Lasse Reichstein Nielsen 2013/01/10 07:02:33 Done.
+ * an error, that will be the result of [:f:] too.
*/
- Future<T> whenComplete(void action());
+ Future<T> whenComplete(Future action());
floitsch 2013/01/09 17:10:13 Don't write the return value here. The editor will
Lasse Reichstein Nielsen 2013/01/10 07:02:33 Ack. The old "returning null implicitly isn't good
/**
* Creates a [Stream] that sends [this]' completion value, data or error, to
« no previous file with comments | « no previous file | sdk/lib/async/future_impl.dart » ('j') | sdk/lib/async/future_impl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698