Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 dart2js.library_loader; | 5 library dart2js.library_loader; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'dart2jslib.dart' show | 9 import 'dart2jslib.dart' show |
| 10 Compiler, | 10 Compiler, |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 523 }); | 523 }); |
| 524 }); | 524 }); |
| 525 } | 525 } |
| 526 | 526 |
| 527 /// Loads the deserialized [library] with the [handler]. | 527 /// Loads the deserialized [library] with the [handler]. |
| 528 /// | 528 /// |
| 529 /// All libraries imported or exported transitively from [library] will be | 529 /// All libraries imported or exported transitively from [library] will be |
| 530 /// loaded as well. | 530 /// loaded as well. |
| 531 Future<LibraryElement> loadDeserializedLibrary( | 531 Future<LibraryElement> loadDeserializedLibrary( |
| 532 LibraryDependencyHandler handler, | 532 LibraryDependencyHandler handler, |
| 533 LibraryElement library) async { | 533 LibraryElement library) async { |
|
Siggi Cherem (dart-lang)
2015/07/23 00:03:06
might be good to remove `async` as well to avoid c
| |
| 534 compiler.onLibraryCreated(library); | 534 compiler.onLibraryCreated(library); |
| 535 libraryCanonicalUriMap[library.canonicalUri] = library; | 535 libraryCanonicalUriMap[library.canonicalUri] = library; |
| 536 await compiler.onLibraryScanned(library, handler); | 536 return compiler.onLibraryScanned(library, handler).then((_) { |
| 537 for (LibraryTag tag in library.tags) { | 537 return future.forEach(library.tags, (LibraryTag tag) { |
| 538 LibraryElement dependency = library.getLibraryFromTag(tag); | 538 LibraryElement dependency = library.getLibraryFromTag(tag); |
| 539 await createLibrary(handler, library, dependency.canonicalUri); | 539 return createLibrary(handler, library, dependency.canonicalUri); |
| 540 } | 540 }).then((_) => library); |
| 541 return library; | 541 }); |
| 542 } | 542 } |
| 543 | 543 |
| 544 /** | 544 /** |
| 545 * Create (or reuse) a library element for the library specified by the | 545 * Create (or reuse) a library element for the library specified by the |
| 546 * [resolvedUri]. | 546 * [resolvedUri]. |
| 547 * | 547 * |
| 548 * If a new library is created, the [handler] is notified. | 548 * If a new library is created, the [handler] is notified. |
| 549 */ | 549 */ |
| 550 Future<LibraryElement> createLibrary(LibraryDependencyHandler handler, | 550 Future<LibraryElement> createLibrary(LibraryDependencyHandler handler, |
| 551 LibraryElement importingLibrary, | 551 LibraryElement importingLibrary, |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1216 } | 1216 } |
| 1217 suffixes.add(const Link<Uri>().prepend(canonicalUri)); | 1217 suffixes.add(const Link<Uri>().prepend(canonicalUri)); |
| 1218 } | 1218 } |
| 1219 suffixChainMap[library] = suffixes; | 1219 suffixChainMap[library] = suffixes; |
| 1220 return; | 1220 return; |
| 1221 } | 1221 } |
| 1222 | 1222 |
| 1223 computeSuffixes(rootLibrary, const Link<Uri>()); | 1223 computeSuffixes(rootLibrary, const Link<Uri>()); |
| 1224 } | 1224 } |
| 1225 } | 1225 } |
| OLD | NEW |