| 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 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * If true, print a warning for each method that was resolved, but not | 8 * If true, print a warning for each method that was resolved, but not |
| 9 * compiled. | 9 * compiled. |
| 10 */ | 10 */ |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 bool isInterceptorClass(ClassElement element) => false; | 396 bool isInterceptorClass(ClassElement element) => false; |
| 397 | 397 |
| 398 void registerStaticUse(Element element, Enqueuer enqueuer) {} | 398 void registerStaticUse(Element element, Enqueuer enqueuer) {} |
| 399 | 399 |
| 400 /// This method is called immediately after the [LibraryElement] [library] has | 400 /// This method is called immediately after the [LibraryElement] [library] has |
| 401 /// been created. | 401 /// been created. |
| 402 void onLibraryCreated(LibraryElement library) {} | 402 void onLibraryCreated(LibraryElement library) {} |
| 403 | 403 |
| 404 /// This method is called immediately after the [library] and its parts have | 404 /// This method is called immediately after the [library] and its parts have |
| 405 /// been scanned. | 405 /// been scanned. |
| 406 void onLibraryScanned(LibraryElement library) {} | 406 Future onLibraryScanned(LibraryElement library, |
| 407 LibraryLoaderCallback callback) { |
| 408 // TODO(johnniwinther): Move this to the JavaScript backend. |
| 409 if (library.isPlatformLibrary && !library.isPatched) { |
| 410 // Apply patch, if any. |
| 411 Uri patchUri = compiler.resolvePatchUri(library.canonicalUri.path); |
| 412 if (patchUri != null) { |
| 413 return compiler.patchParser.patchLibrary(callback, patchUri, library); |
| 414 } |
| 415 } |
| 416 return new Future.value(); |
| 417 } |
| 407 | 418 |
| 408 /// This method is called when all new libraries loaded through | 419 /// This method is called when all new libraries loaded through |
| 409 /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports | 420 /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports |
| 410 /// have been computed. | 421 /// have been computed. |
| 411 Future onLibrariesLoaded(Map<Uri, LibraryElement> loadedLibraries) { | 422 Future onLibrariesLoaded(Map<Uri, LibraryElement> loadedLibraries) { |
| 412 return new Future.value(); | 423 return new Future.value(); |
| 413 } | 424 } |
| 414 | 425 |
| 415 /// Called by [MirrorUsageAnalyzerTask] after it has merged all @MirrorsUsed | 426 /// Called by [MirrorUsageAnalyzerTask] after it has merged all @MirrorsUsed |
| 416 /// annotations. The arguments corresponds to the unions of the corresponding | 427 /// annotations. The arguments corresponds to the unions of the corresponding |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 } | 1055 } |
| 1045 backend.onLibraryCreated(library); | 1056 backend.onLibraryCreated(library); |
| 1046 } | 1057 } |
| 1047 | 1058 |
| 1048 /// This method is called immediately after the [library] and its parts have | 1059 /// This method is called immediately after the [library] and its parts have |
| 1049 /// been scanned. | 1060 /// been scanned. |
| 1050 /// | 1061 /// |
| 1051 /// Use this callback method to store references to specific member declared | 1062 /// Use this callback method to store references to specific member declared |
| 1052 /// in certain libraries. Note that [library] has not been patched yet, nor | 1063 /// in certain libraries. Note that [library] has not been patched yet, nor |
| 1053 /// has its imports/exports been resolved. | 1064 /// has its imports/exports been resolved. |
| 1054 void onLibraryScanned(LibraryElement library) { | 1065 /// |
| 1066 /// Use [callback] to register the creation and scanning of a patch library |
| 1067 /// for [library]. |
| 1068 Future onLibraryScanned(LibraryElement library, |
| 1069 LibraryLoaderCallback callback) { |
| 1055 Uri uri = library.canonicalUri; | 1070 Uri uri = library.canonicalUri; |
| 1056 if (uri == DART_CORE) { | 1071 if (uri == DART_CORE) { |
| 1057 initializeCoreClasses(); | 1072 initializeCoreClasses(); |
| 1058 identicalFunction = coreLibrary.find('identical'); | 1073 identicalFunction = coreLibrary.find('identical'); |
| 1059 } else if (uri == DART_JS_HELPER) { | 1074 } else if (uri == DART_JS_HELPER) { |
| 1060 initializeHelperClasses(); | 1075 initializeHelperClasses(); |
| 1061 assertMethod = jsHelperLibrary.find('assertHelper'); | 1076 assertMethod = jsHelperLibrary.find('assertHelper'); |
| 1062 } else if (uri == DART_INTERNAL) { | 1077 } else if (uri == DART_INTERNAL) { |
| 1063 symbolImplementationClass = findRequiredElement(library, 'Symbol'); | 1078 symbolImplementationClass = findRequiredElement(library, 'Symbol'); |
| 1064 } else if (uri == DART_MIRRORS) { | 1079 } else if (uri == DART_MIRRORS) { |
| 1065 mirrorSystemClass = findRequiredElement(library, 'MirrorSystem'); | 1080 mirrorSystemClass = findRequiredElement(library, 'MirrorSystem'); |
| 1066 mirrorsUsedClass = findRequiredElement(library, 'MirrorsUsed'); | 1081 mirrorsUsedClass = findRequiredElement(library, 'MirrorsUsed'); |
| 1067 } else if (uri == DART_ASYNC) { | 1082 } else if (uri == DART_ASYNC) { |
| 1068 deferredLibraryClass = findRequiredElement(library, 'DeferredLibrary'); | 1083 deferredLibraryClass = findRequiredElement(library, 'DeferredLibrary'); |
| 1069 } else if (uri == DART_NATIVE_TYPED_DATA) { | 1084 } else if (uri == DART_NATIVE_TYPED_DATA) { |
| 1070 typedDataClass = findRequiredElement(library, 'NativeTypedData'); | 1085 typedDataClass = findRequiredElement(library, 'NativeTypedData'); |
| 1071 } | 1086 } |
| 1072 backend.onLibraryScanned(library); | 1087 return backend.onLibraryScanned(library, callback); |
| 1073 } | 1088 } |
| 1074 | 1089 |
| 1075 /// This method is called when all new libraries loaded through | 1090 /// This method is called when all new libraries loaded through |
| 1076 /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports | 1091 /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports |
| 1077 /// have been computed. | 1092 /// have been computed. |
| 1078 /// | 1093 /// |
| 1079 /// [loadedLibraries] contains the newly loaded libraries. | 1094 /// [loadedLibraries] contains the newly loaded libraries. |
| 1080 /// | 1095 /// |
| 1081 /// The method returns a [Future] allowing for the loading of additional | 1096 /// The method returns a [Future] allowing for the loading of additional |
| 1082 /// libraries. | 1097 /// libraries. |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2004 static NullSink outputProvider(String name, String extension) { | 2019 static NullSink outputProvider(String name, String extension) { |
| 2005 return new NullSink('$name.$extension'); | 2020 return new NullSink('$name.$extension'); |
| 2006 } | 2021 } |
| 2007 } | 2022 } |
| 2008 | 2023 |
| 2009 /// Information about suppressed warnings and hints for a given library. | 2024 /// Information about suppressed warnings and hints for a given library. |
| 2010 class SuppressionInfo { | 2025 class SuppressionInfo { |
| 2011 int warnings = 0; | 2026 int warnings = 0; |
| 2012 int hints = 0; | 2027 int hints = 0; |
| 2013 } | 2028 } |
| OLD | NEW |