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

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

Issue 11830017: Fix ALL the pub tests. (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
Index: sdk/lib/async/future_impl.dart
diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart
index 6ed41c9bfcd72d442fb126de1819cd0a8d839240..ceae395e363b3cb27e909278880829fc6b61331c 100644
--- a/sdk/lib/async/future_impl.dart
+++ b/sdk/lib/async/future_impl.dart
@@ -109,6 +109,7 @@ class _FutureImpl<T> implements Future<T> {
// As each future completes, put its value into the corresponding
// position in the list of values.
int i = 0;
+ bool completed = false;
for (Future future in futures) {
int pos = i++;
future.then((Object value) {
@@ -116,9 +117,9 @@ class _FutureImpl<T> implements Future<T> {
if (--remaining == 0) {
completer.complete(values);
}
- });
- future.catchError((error) {
- completer.completeError(error.error, error.stackTrace);
+ }).catchError((error) {
+ if (!completed) completer.completeError(error.error, error.stackTrace);
+ completed = true;
});
}
« no previous file with comments | « pkg/http/test/utils.dart ('k') | tests/lib/async/futures_test.dart » ('j') | utils/pub/git.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698