| Index: sdk/lib/async/future.dart
|
| diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
|
| index 3841ff8fec36fa6a48f67882f6a3789e5dd91731..4f1df90488355237b72866d04786b65987af6d12 100644
|
| --- a/sdk/lib/async/future.dart
|
| +++ b/sdk/lib/async/future.dart
|
| @@ -485,8 +485,10 @@ abstract class Future<T> {
|
| var nextIteration;
|
| // Bind this callback explicitly so that each iteration isn't bound in the
|
| // context of all the previous iterations' callbacks.
|
| + // This avoids, e.g., deeply nested stack traces from the stack trace
|
| + // package.
|
| nextIteration = Zone.current.bindUnaryCallback((bool keepGoing) {
|
| - if (keepGoing) {
|
| + while (keepGoing) {
|
| FutureOr<bool> result;
|
| try {
|
| result = f();
|
| @@ -500,10 +502,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;
|
|
|