Chromium Code Reviews| 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]); |