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

Unified Diff: pkg/compiler/lib/src/apiimpl.dart

Issue 1226323002: Remove 'async-await' usage from the dart2js compiler. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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: pkg/compiler/lib/src/apiimpl.dart
diff --git a/pkg/compiler/lib/src/apiimpl.dart b/pkg/compiler/lib/src/apiimpl.dart
index 9fd865acec57283e887d4bde311919d1f3593546..574ee0e4cdd50a773e8a849d614c9f67e226221d 100644
--- a/pkg/compiler/lib/src/apiimpl.dart
+++ b/pkg/compiler/lib/src/apiimpl.dart
@@ -369,46 +369,52 @@ class Compiler extends leg.Compiler {
});
}
- Future setupPackages(Uri uri) async {
+ Future setupPackages(Uri uri) {
if (packageRoot != null) {
// Use "non-file" packages because the file version requires a [Directory]
// and we can't depend on 'dart:io' classes.
packages = new NonFilePackagesDirectoryPackages(packageRoot);
} else if (packageConfig != null) {
- var packageConfigContents = await provider(packageConfig);
- if (packageConfigContents is String) {
- packageConfigContents = UTF8.encode(packageConfigContents);
- }
- packages =
- new MapPackages(pkgs.parse(packageConfigContents, packageConfig));
+ return provider(packageConfig).then((packageConfigContents) {
+ if (packageConfigContents is String) {
+ packageConfigContents = UTF8.encode(packageConfigContents);
+ }
+ packages =
+ new MapPackages(pkgs.parse(packageConfigContents, packageConfig));
+ });
} else {
if (packagesDiscoveryProvider == null) {
packages = Packages.noPackages;
} else {
- packages = await callUserPackagesDiscovery(uri);
+ return callUserPackagesDiscovery(uri).then((p) {
+ packages = p;
+ });
}
}
+ return new Future.value();
}
- Future<bool> run(Uri uri) async {
+ Future<bool> run(Uri uri) {
log('Allowed library categories: $allowedLibraryCategories');
- await setupPackages(uri);
- assert(packages != null);
-
- bool success = await super.run(uri);
- int cumulated = 0;
- for (final task in tasks) {
- int elapsed = task.timing;
- if (elapsed != 0) {
- cumulated += elapsed;
- log('${task.name} took ${elapsed}msec');
- }
- }
- int total = totalCompileTime.elapsedMilliseconds;
- log('Total compile-time ${total}msec;'
- ' unaccounted ${total - cumulated}msec');
- return success;
+ return setupPackages(uri).then((_) {
+ assert(packages != null);
+
+ return super.run(uri).then((bool success) {
+ int cumulated = 0;
+ for (final task in tasks) {
+ int elapsed = task.timing;
+ if (elapsed != 0) {
+ cumulated += elapsed;
+ log('${task.name} took ${elapsed}msec');
+ }
+ }
+ int total = totalCompileTime.elapsedMilliseconds;
+ log('Total compile-time ${total}msec;'
+ ' unaccounted ${total - cumulated}msec');
+ return success;
+ });
+ });
}
void reportDiagnostic(leg.Spannable node,
« 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