From 66a1ff70adb71a431a55e8861dd774d7037f7003 Mon Sep 17 00:00:00 2001
From: "nweiz@google.com" <nweiz@google.com>
Date: Tue, 2 Dec 2014 01:52:42 +0000
Subject: [PATCH] Fix a couple bugs in r42055.

This works around https://github.com/dart-lang/async_await/issues/72,
fixes an incorrect variable name, and updates the async-compiled
output.

R=rnystrom@google.com
TBR

Review URL: https://codereview.chromium.org//766393002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@42057 260f80e4-7a28-3924-810f-c04153c831b5
---
 lib/src/io.dart            | 2 +-
 lib/src/source/hosted.dart | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/src/io.dart b/lib/src/io.dart
index 58a52ef0..2f137b60 100644
--- a/lib/src/io.dart
+++ b/lib/src/io.dart
@@ -398,7 +398,7 @@ void tryDeleteEntry(String path) {
   try {
     deleteEntry(path);
   } catch (error, stackTrace) {
-    log.fine("Failed to delete $entry: $error\n"
+    log.fine("Failed to delete $path: $error\n"
         "${new Chain.forTrace(stackTrace)}");
   }
 }
diff --git a/lib/src/source/hosted.dart b/lib/src/source/hosted.dart
index 825a8725..593f9935 100644
--- a/lib/src/source/hosted.dart
+++ b/lib/src/source/hosted.dart
@@ -134,7 +134,9 @@ class HostedSource extends CachedSource {
       var url = _directoryToUrl(path.basename(serverDir));
       var packages = _getCachedPackagesInDirectory(path.basename(serverDir));
       packages.sort(Package.orderByNameAndVersion);
-      for (var package in packages) {
+      // TODO(nweiz): Use a normal for loop here when
+      // https://github.com/dart-lang/async_await/issues/72 is fixed.
+      await Future.forEach(packages, (package) async {
         try {
           await _download(url, package.name, package.version, package.dir);
           successes++;
@@ -148,7 +150,7 @@ class HostedSource extends CachedSource {
 
           tryDeleteEntry(package.dir);
         }
-      }
+      });
     }
 
     return new Pair(successes, failures);
-- 
GitLab