| 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 16 matching lines...) Expand all Loading... |
| 27 LibraryDependencyElementX, | 27 LibraryDependencyElementX, |
| 28 PrefixElementX, | 28 PrefixElementX, |
| 29 SyntheticImportElement; | 29 SyntheticImportElement; |
| 30 import 'environment.dart'; | 30 import 'environment.dart'; |
| 31 import 'resolved_uri_translator.dart'; | 31 import 'resolved_uri_translator.dart'; |
| 32 import 'script.dart'; | 32 import 'script.dart'; |
| 33 import 'serialization/serialization.dart' show LibraryDeserializer; | 33 import 'serialization/serialization.dart' show LibraryDeserializer; |
| 34 import 'tree/tree.dart'; | 34 import 'tree/tree.dart'; |
| 35 import 'util/util.dart' show Link, LinkBuilder; | 35 import 'util/util.dart' show Link, LinkBuilder; |
| 36 | 36 |
| 37 typedef Future<Iterable<LibraryElement>> ReuseLibrariesFunction( | |
| 38 Iterable<LibraryElement> libraries); | |
| 39 | |
| 40 /** | 37 /** |
| 41 * [CompilerTask] for loading libraries and setting up the import/export scopes. | 38 * [CompilerTask] for loading libraries and setting up the import/export scopes. |
| 42 * | 39 * |
| 43 * The library loader uses four different kinds of URIs in different parts of | 40 * The library loader uses four different kinds of URIs in different parts of |
| 44 * the loading process. | 41 * the loading process. |
| 45 * | 42 * |
| 46 * ## User URI ## | 43 * ## User URI ## |
| 47 * | 44 * |
| 48 * A 'user URI' is a URI provided by the user in code and as the main entry URI | 45 * A 'user URI' is a URI provided by the user in code and as the main entry URI |
| 49 * at the command line. These generally come in 3 versions: | 46 * at the command line. These generally come in 3 versions: |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 /// libraries matching [reuseLibrary] are reused. | 160 /// libraries matching [reuseLibrary] are reused. |
| 164 /// | 161 /// |
| 165 /// This method is used for incremental compilation. | 162 /// This method is used for incremental compilation. |
| 166 void reset({bool reuseLibrary(LibraryElement library)}); | 163 void reset({bool reuseLibrary(LibraryElement library)}); |
| 167 | 164 |
| 168 /// Asynchronous version of [reset]. | 165 /// Asynchronous version of [reset]. |
| 169 Future resetAsync(Future<bool> reuseLibrary(LibraryElement library)); | 166 Future resetAsync(Future<bool> reuseLibrary(LibraryElement library)); |
| 170 | 167 |
| 171 /// Similar to [resetAsync] but [reuseLibrary] maps all libraries to a list | 168 /// Similar to [resetAsync] but [reuseLibrary] maps all libraries to a list |
| 172 /// of libraries that can be reused. | 169 /// of libraries that can be reused. |
| 173 Future<Null> resetLibraries(ReuseLibrariesFunction reuseLibraries); | 170 Future<Null> resetLibraries( |
| 171 Future<Iterable<LibraryElement>> <- (Iterable<LibraryElement>) |
| 172 reuseLibraries); |
| 174 } | 173 } |
| 175 | 174 |
| 176 /// Interface for an entity that provide libraries. For instance from normal | 175 /// Interface for an entity that provide libraries. For instance from normal |
| 177 /// library loading or from deserialization. | 176 /// library loading or from deserialization. |
| 178 // TODO(johnniwinther): Use this to integrate deserialized libraries better. | 177 // TODO(johnniwinther): Use this to integrate deserialized libraries better. |
| 179 abstract class LibraryProvider { | 178 abstract class LibraryProvider { |
| 180 /// Looks up the library with the [canonicalUri]. | 179 /// Looks up the library with the [canonicalUri]. |
| 181 LibraryElement lookupLibrary(Uri canonicalUri); | 180 LibraryElement lookupLibrary(Uri canonicalUri); |
| 182 } | 181 } |
| 183 | 182 |
| (...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 Future onLibrariesLoaded(LoadedLibraries results); | 1516 Future onLibrariesLoaded(LoadedLibraries results); |
| 1518 | 1517 |
| 1519 /// Called whenever a library element is created. | 1518 /// Called whenever a library element is created. |
| 1520 void onLibraryCreated(LibraryElement library); | 1519 void onLibraryCreated(LibraryElement library); |
| 1521 | 1520 |
| 1522 /// Called whenever a library is scanned from a script file. | 1521 /// Called whenever a library is scanned from a script file. |
| 1523 Future onLibraryScanned(LibraryElement library, LibraryLoader loader); | 1522 Future onLibraryScanned(LibraryElement library, LibraryLoader loader); |
| 1524 } | 1523 } |
| 1525 | 1524 |
| 1526 const _reuseLibrarySubtaskName = "Reuse library"; | 1525 const _reuseLibrarySubtaskName = "Reuse library"; |
| OLD | NEW |