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

Unified Diff: corelib/src/future.dart

Issue 9166037: Remove redundant code from Futures.wait. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: corelib/src/future.dart
===================================================================
--- corelib/src/future.dart (revision 3177)
+++ corelib/src/future.dart (working copy)
@@ -132,24 +132,19 @@
// As each future completes, put its value into the corresponding
// position in the list of values.
for (int i = 0; i < futures.length; i++) {
- if (futures[i].isComplete) {
- values[i] = futures[i].value;
- remaining--;
- } else {
- // TODO(mattsh) - remove this after bug
- // http://code.google.com/p/dart/issues/detail?id=333 is fixed.
- int pos = i;
- futures[pos].then((Object value) {
- values[pos] = value;
- if (--remaining == 0) {
- completer.complete(values);
- }
- });
- }
+ // TODO(mattsh) - remove this after bug
+ // http://code.google.com/p/dart/issues/detail?id=333 is fixed.
+ int pos = i;
+ futures[pos].then((Object value) {
+ values[pos] = value;
+ if (--remaining == 0) {
+ completer.complete(values);
+ }
+ });
}
// Special case where all the futures are already completed,
// trigger the value now.
- if (remaining == 0) {
+ if (futures.length == 0) {
completer.complete(values);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698