| 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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 /// This method is called immediately after the [library] and its parts have | 382 /// This method is called immediately after the [library] and its parts have |
| 383 /// been scanned. | 383 /// been scanned. |
| 384 Future onLibraryScanned(LibraryElement library, LibraryLoader loader) { | 384 Future onLibraryScanned(LibraryElement library, LibraryLoader loader) { |
| 385 if (library.isPlatformLibrary && !library.isPatched) { | 385 if (library.isPlatformLibrary && !library.isPatched) { |
| 386 // Apply patch, if any. | 386 // Apply patch, if any. |
| 387 Uri patchUri = compiler.resolvePatchUri(library.canonicalUri.path); | 387 Uri patchUri = compiler.resolvePatchUri(library.canonicalUri.path); |
| 388 if (patchUri != null) { | 388 if (patchUri != null) { |
| 389 return compiler.patchParser.patchLibrary(loader, patchUri, library); | 389 return compiler.patchParser.patchLibrary(loader, patchUri, library); |
| 390 } | 390 } |
| 391 } | 391 } |
| 392 if (library.canUseNative) { |
| 393 library.forEachLocalMember((Element element) { |
| 394 if (element.isClass) { |
| 395 checkNativeAnnotation(compiler, element); |
| 396 } |
| 397 }); |
| 398 } |
| 392 return new Future.value(); | 399 return new Future.value(); |
| 393 } | 400 } |
| 394 | 401 |
| 395 /// This method is called when all new libraries loaded through | 402 /// This method is called when all new libraries loaded through |
| 396 /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports | 403 /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports |
| 397 /// have been computed. | 404 /// have been computed. |
| 398 Future onLibrariesLoaded(Map<Uri, LibraryElement> loadedLibraries) { | 405 Future onLibrariesLoaded(Map<Uri, LibraryElement> loadedLibraries) { |
| 399 return new Future.value(); | 406 return new Future.value(); |
| 400 } | 407 } |
| 401 | 408 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 ClassElement stackTraceClass; | 722 ClassElement stackTraceClass; |
| 716 ClassElement typedDataClass; | 723 ClassElement typedDataClass; |
| 717 | 724 |
| 718 /// The constant for the [proxy] variable defined in dart:core. | 725 /// The constant for the [proxy] variable defined in dart:core. |
| 719 Constant proxyConstant; | 726 Constant proxyConstant; |
| 720 | 727 |
| 721 // TODO(johnniwinther): Move this to the JavaScriptBackend. | 728 // TODO(johnniwinther): Move this to the JavaScriptBackend. |
| 722 /// The constant for the [patch] variable defined in dart:_js_helper. | 729 /// The constant for the [patch] variable defined in dart:_js_helper. |
| 723 Constant patchConstant; | 730 Constant patchConstant; |
| 724 | 731 |
| 732 // TODO(johnniwinther): Move this to the JavaScriptBackend. |
| 733 ClassElement nativeAnnotationClass; |
| 734 |
| 725 // Initialized after symbolClass has been resolved. | 735 // Initialized after symbolClass has been resolved. |
| 726 FunctionElement symbolConstructor; | 736 FunctionElement symbolConstructor; |
| 727 | 737 |
| 728 // Initialized when dart:mirrors is loaded. | 738 // Initialized when dart:mirrors is loaded. |
| 729 ClassElement mirrorSystemClass; | 739 ClassElement mirrorSystemClass; |
| 730 | 740 |
| 731 // Initialized when dart:mirrors is loaded. | 741 // Initialized when dart:mirrors is loaded. |
| 732 ClassElement mirrorsUsedClass; | 742 ClassElement mirrorsUsedClass; |
| 733 | 743 |
| 734 // Initialized after mirrorSystemClass has been resolved. | 744 // Initialized after mirrorSystemClass has been resolved. |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 identicalFunction = coreLibrary.find('identical'); | 1121 identicalFunction = coreLibrary.find('identical'); |
| 1112 } else if (uri == DART_INTERNAL) { | 1122 } else if (uri == DART_INTERNAL) { |
| 1113 symbolImplementationClass = findRequiredElement(library, 'Symbol'); | 1123 symbolImplementationClass = findRequiredElement(library, 'Symbol'); |
| 1114 } else if (uri == DART_MIRRORS) { | 1124 } else if (uri == DART_MIRRORS) { |
| 1115 mirrorSystemClass = findRequiredElement(library, 'MirrorSystem'); | 1125 mirrorSystemClass = findRequiredElement(library, 'MirrorSystem'); |
| 1116 mirrorsUsedClass = findRequiredElement(library, 'MirrorsUsed'); | 1126 mirrorsUsedClass = findRequiredElement(library, 'MirrorsUsed'); |
| 1117 } else if (uri == DART_ASYNC) { | 1127 } else if (uri == DART_ASYNC) { |
| 1118 deferredLibraryClass = findRequiredElement(library, 'DeferredLibrary'); | 1128 deferredLibraryClass = findRequiredElement(library, 'DeferredLibrary'); |
| 1119 } else if (uri == DART_NATIVE_TYPED_DATA) { | 1129 } else if (uri == DART_NATIVE_TYPED_DATA) { |
| 1120 typedDataClass = findRequiredElement(library, 'NativeTypedData'); | 1130 typedDataClass = findRequiredElement(library, 'NativeTypedData'); |
| 1131 } else if (uri == js_backend.JavaScriptBackend.DART_JS_HELPER) { |
| 1132 nativeAnnotationClass = findRequiredElement(library, 'Native'); |
| 1121 } | 1133 } |
| 1122 return backend.onLibraryScanned(library, loader); | 1134 return backend.onLibraryScanned(library, loader); |
| 1123 } | 1135 } |
| 1124 | 1136 |
| 1125 /// This method is called when all new libraries loaded through | 1137 /// This method is called when all new libraries loaded through |
| 1126 /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports | 1138 /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports |
| 1127 /// have been computed. | 1139 /// have been computed. |
| 1128 /// | 1140 /// |
| 1129 /// [loadedLibraries] contains the newly loaded libraries. | 1141 /// [loadedLibraries] contains the newly loaded libraries. |
| 1130 /// | 1142 /// |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 static NullSink outputProvider(String name, String extension) { | 2035 static NullSink outputProvider(String name, String extension) { |
| 2024 return new NullSink('$name.$extension'); | 2036 return new NullSink('$name.$extension'); |
| 2025 } | 2037 } |
| 2026 } | 2038 } |
| 2027 | 2039 |
| 2028 /// Information about suppressed warnings and hints for a given library. | 2040 /// Information about suppressed warnings and hints for a given library. |
| 2029 class SuppressionInfo { | 2041 class SuppressionInfo { |
| 2030 int warnings = 0; | 2042 int warnings = 0; |
| 2031 int hints = 0; | 2043 int hints = 0; |
| 2032 } | 2044 } |
| OLD | NEW |