| 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 'common/names.dart' show Uris; | 9 import 'common/names.dart' show Uris; |
| 10 import 'common/tasks.dart' show CompilerTask, Measurer; | 10 import 'common/tasks.dart' show CompilerTask, Measurer; |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 /// Loads the deserialized [library] with the [handler]. | 642 /// Loads the deserialized [library] with the [handler]. |
| 643 /// | 643 /// |
| 644 /// All libraries imported or exported transitively from [library] will be | 644 /// All libraries imported or exported transitively from [library] will be |
| 645 /// loaded as well. | 645 /// loaded as well. |
| 646 Future<LibraryElement> loadDeserializedLibrary( | 646 Future<LibraryElement> loadDeserializedLibrary( |
| 647 LibraryDependencyHandler handler, LibraryElement library) { | 647 LibraryDependencyHandler handler, LibraryElement library) { |
| 648 libraryCanonicalUriMap[library.canonicalUri] = library; | 648 libraryCanonicalUriMap[library.canonicalUri] = library; |
| 649 handler.registerNewLibrary(library); | 649 handler.registerNewLibrary(library); |
| 650 return listener.onLibraryScanned(library, handler).then((_) { | 650 return listener.onLibraryScanned(library, handler).then((_) { |
| 651 return Future.forEach(library.imports, (ImportElement import) { | 651 return Future.forEach(library.imports, (ImportElement import) { |
| 652 return createLibrary(handler, library, import.uri); | 652 Uri resolvedUri = library.canonicalUri.resolveUri(import.uri); |
| 653 return createLibrary(handler, library, resolvedUri); |
| 653 }).then((_) { | 654 }).then((_) { |
| 654 return Future.forEach(library.exports, (ExportElement export) { | 655 return Future.forEach(library.exports, (ExportElement export) { |
| 655 return createLibrary(handler, library, export.uri); | 656 Uri resolvedUri = library.canonicalUri.resolveUri(export.uri); |
| 657 return createLibrary(handler, library, resolvedUri); |
| 658 }).then((_) { |
| 659 // TODO(johnniwinther): Shouldn't there be an [ImportElement] for the |
| 660 // implicit import of dart:core? |
| 661 return createLibrary(handler, library, Uris.dart_core); |
| 656 }).then((_) => library); | 662 }).then((_) => library); |
| 657 }); | 663 }); |
| 658 }); | 664 }); |
| 659 } | 665 } |
| 660 | 666 |
| 661 Future<Script> _readScript( | 667 Future<Script> _readScript( |
| 662 Spannable spannable, Uri readableUri, Uri resolvedUri) { | 668 Spannable spannable, Uri readableUri, Uri resolvedUri) { |
| 663 if (readableUri == null) { | 669 if (readableUri == null) { |
| 664 return new Future.value(new Script.synthetic(resolvedUri)); | 670 return new Future.value(new Script.synthetic(resolvedUri)); |
| 665 } else { | 671 } else { |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 Future onLibrariesLoaded(LoadedLibraries results); | 1518 Future onLibrariesLoaded(LoadedLibraries results); |
| 1513 | 1519 |
| 1514 /// Called whenever a library element is created. | 1520 /// Called whenever a library element is created. |
| 1515 void onLibraryCreated(LibraryElement library); | 1521 void onLibraryCreated(LibraryElement library); |
| 1516 | 1522 |
| 1517 /// Called whenever a library is scanned from a script file. | 1523 /// Called whenever a library is scanned from a script file. |
| 1518 Future onLibraryScanned(LibraryElement library, LibraryLoader loader); | 1524 Future onLibraryScanned(LibraryElement library, LibraryLoader loader); |
| 1519 } | 1525 } |
| 1520 | 1526 |
| 1521 const _reuseLibrarySubtaskName = "Reuse library"; | 1527 const _reuseLibrarySubtaskName = "Reuse library"; |
| OLD | NEW |