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

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

Issue 50373002: Change and documentat how completer handles futures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change signature everywhere. Created 7 years, 2 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 335714be7f7b720a6d0b7b49b533e9c9dc010942..f33028be95b85ee7d7fc49e30d4febbb4dc1f6e8 100644
--- a/sdk/lib/async/future.dart
+++ b/sdk/lib/async/future.dart
@@ -487,17 +487,25 @@ abstract class Completer<T> {
/**
* Completes [future] with the supplied values.
*
+ * If the value is itself a future, the completer will wait for that future
+ * to complete, and complete with the same result, whether it is a success
+ * or an error.
+ *
+ * Calling `complete` or [completeError] must not be done more than once.
+ *
* All listeners on the future are informed about the value.
*/
- void complete([T value]);
+ void complete([value]);
/**
* Complete [future] with an error.
*
+ * Calling [complete] or `completeError` must not be done more than once.
+ *
* Completing a future with an error indicates that an exception was thrown
* while trying to produce a value.
*
- * The argument [error] must not be `null`.
+ * The argument [error] must not be `null`, and it must not be a future.
floitsch 2013/10/29 18:13:35 Why this restriction? I'm ok with it being a futu
Lasse Reichstein Nielsen 2013/10/30 09:22:17 If the result of a future cannot be a future, I as
floitsch 2013/10/30 18:50:53 Error handlers are frequently piped (like for exam
*/
void completeError(Object error, [StackTrace stackTrace]);
« 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