Chromium Code Reviews| Index: sdk/lib/async/future.dart |
| diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart |
| index 3841ff8fec36fa6a48f67882f6a3789e5dd91731..7f0c2a333acc536515d680a033dfa006b64c7a4c 100644 |
| --- a/sdk/lib/async/future.dart |
| +++ b/sdk/lib/async/future.dart |
| @@ -486,7 +486,7 @@ abstract class Future<T> { |
| // Bind this callback explicitly so that each iteration isn't bound in the |
| // context of all the previous iterations' callbacks. |
|
floitsch
2017/05/02 10:16:56
Mention stacktrace package here.
|
| nextIteration = Zone.current.bindUnaryCallback((bool keepGoing) { |
| - if (keepGoing) { |
| + while (keepGoing) { |
| FutureOr<bool> result; |
| try { |
| result = f(); |
| @@ -500,10 +500,9 @@ abstract class Future<T> { |
| result.then(nextIteration, onError: doneSignal._completeError); |
| return; |
| } |
| - nextIteration(result); |
| - } else { |
| - doneSignal._complete(null); |
| + keepGoing = result; |
| } |
| + doneSignal._complete(null); |
| }, runGuarded: true); |
| nextIteration(true); |
| return doneSignal; |