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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library leg_apiimpl; 5 library leg_apiimpl;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import '../compiler.dart' as api; 10 import '../compiler.dart' as api;
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 notFound: (Uri notFound) { 362 notFound: (Uri notFound) {
363 reportError( 363 reportError(
364 node, 364 node,
365 leg.MessageKind.LIBRARY_NOT_FOUND, 365 leg.MessageKind.LIBRARY_NOT_FOUND,
366 {'resolvedUri': uri} 366 {'resolvedUri': uri}
367 ); 367 );
368 return null; 368 return null;
369 }); 369 });
370 } 370 }
371 371
372 Future setupPackages(Uri uri) async { 372 Future setupPackages(Uri uri) {
373 if (packageRoot != null) { 373 if (packageRoot != null) {
374 // Use "non-file" packages because the file version requires a [Directory] 374 // Use "non-file" packages because the file version requires a [Directory]
375 // and we can't depend on 'dart:io' classes. 375 // and we can't depend on 'dart:io' classes.
376 packages = new NonFilePackagesDirectoryPackages(packageRoot); 376 packages = new NonFilePackagesDirectoryPackages(packageRoot);
377 } else if (packageConfig != null) { 377 } else if (packageConfig != null) {
378 var packageConfigContents = await provider(packageConfig); 378 return provider(packageConfig).then((packageConfigContents) {
379 if (packageConfigContents is String) { 379 if (packageConfigContents is String) {
380 packageConfigContents = UTF8.encode(packageConfigContents); 380 packageConfigContents = UTF8.encode(packageConfigContents);
381 } 381 }
382 packages = 382 packages =
383 new MapPackages(pkgs.parse(packageConfigContents, packageConfig)); 383 new MapPackages(pkgs.parse(packageConfigContents, packageConfig));
384 });
384 } else { 385 } else {
385 if (packagesDiscoveryProvider == null) { 386 if (packagesDiscoveryProvider == null) {
386 packages = Packages.noPackages; 387 packages = Packages.noPackages;
387 } else { 388 } else {
388 packages = await callUserPackagesDiscovery(uri); 389 return callUserPackagesDiscovery(uri).then((p) {
390 packages = p;
391 });
389 } 392 }
390 } 393 }
394 return new Future.value();
391 } 395 }
392 396
393 Future<bool> run(Uri uri) async { 397 Future<bool> run(Uri uri) {
394 log('Allowed library categories: $allowedLibraryCategories'); 398 log('Allowed library categories: $allowedLibraryCategories');
395 399
396 await setupPackages(uri); 400 return setupPackages(uri).then((_) {
397 assert(packages != null); 401 assert(packages != null);
398 402
399 bool success = await super.run(uri); 403 return super.run(uri).then((bool success) {
400 int cumulated = 0; 404 int cumulated = 0;
401 for (final task in tasks) { 405 for (final task in tasks) {
402 int elapsed = task.timing; 406 int elapsed = task.timing;
403 if (elapsed != 0) { 407 if (elapsed != 0) {
404 cumulated += elapsed; 408 cumulated += elapsed;
405 log('${task.name} took ${elapsed}msec'); 409 log('${task.name} took ${elapsed}msec');
406 } 410 }
407 } 411 }
408 int total = totalCompileTime.elapsedMilliseconds; 412 int total = totalCompileTime.elapsedMilliseconds;
409 log('Total compile-time ${total}msec;' 413 log('Total compile-time ${total}msec;'
410 ' unaccounted ${total - cumulated}msec'); 414 ' unaccounted ${total - cumulated}msec');
411 return success; 415 return success;
416 });
417 });
412 } 418 }
413 419
414 void reportDiagnostic(leg.Spannable node, 420 void reportDiagnostic(leg.Spannable node,
415 leg.Message message, 421 leg.Message message,
416 api.Diagnostic kind) { 422 api.Diagnostic kind) {
417 leg.SourceSpan span = spanFromSpannable(node); 423 leg.SourceSpan span = spanFromSpannable(node);
418 if (identical(kind, api.Diagnostic.ERROR) 424 if (identical(kind, api.Diagnostic.ERROR)
419 || identical(kind, api.Diagnostic.CRASH) 425 || identical(kind, api.Diagnostic.CRASH)
420 || (fatalWarnings && identical(kind, api.Diagnostic.WARNING))) { 426 || (fatalWarnings && identical(kind, api.Diagnostic.WARNING))) {
421 compilationFailed = true; 427 compilationFailed = true;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 print('$message: ${tryToString(exception)}'); 477 print('$message: ${tryToString(exception)}');
472 print(tryToString(stackTrace)); 478 print(tryToString(stackTrace));
473 } 479 }
474 480
475 fromEnvironment(String name) => environment[name]; 481 fromEnvironment(String name) => environment[name];
476 482
477 LibraryInfo lookupLibraryInfo(String libraryName) { 483 LibraryInfo lookupLibraryInfo(String libraryName) {
478 return library_info.LIBRARIES[libraryName]; 484 return library_info.LIBRARIES[libraryName];
479 } 485 }
480 } 486 }
OLDNEW
« 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