| 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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 /// `true` if the last diagnostic was filtered, in which case the | 711 /// `true` if the last diagnostic was filtered, in which case the |
| 712 /// accompanying info message should be filtered as well. | 712 /// accompanying info message should be filtered as well. |
| 713 bool lastDiagnosticWasFiltered = false; | 713 bool lastDiagnosticWasFiltered = false; |
| 714 | 714 |
| 715 /// Map containing information about the warnings and hints that have been | 715 /// Map containing information about the warnings and hints that have been |
| 716 /// suppressed for each library. | 716 /// suppressed for each library. |
| 717 Map<Uri, SuppressionInfo> suppressedWarnings = <Uri, SuppressionInfo>{}; | 717 Map<Uri, SuppressionInfo> suppressedWarnings = <Uri, SuppressionInfo>{}; |
| 718 | 718 |
| 719 final bool suppressWarnings; | 719 final bool suppressWarnings; |
| 720 | 720 |
| 721 /// `true` if async/await features are supported. |
| 722 final bool enableAsyncAwait; |
| 723 |
| 721 /// If `true`, some values are cached for reuse in incremental compilation. | 724 /// If `true`, some values are cached for reuse in incremental compilation. |
| 722 /// Incremental compilation is basically calling [run] more than once. | 725 /// Incremental compilation is basically calling [run] more than once. |
| 723 final bool hasIncrementalSupport; | 726 final bool hasIncrementalSupport; |
| 724 | 727 |
| 725 api.CompilerOutputProvider outputProvider; | 728 api.CompilerOutputProvider outputProvider; |
| 726 | 729 |
| 727 bool disableInlining = false; | 730 bool disableInlining = false; |
| 728 | 731 |
| 729 /// True if compilation was aborted with a [CompilerCancelledException]. Only | 732 /// True if compilation was aborted with a [CompilerCancelledException]. Only |
| 730 /// set after Future retuned by [run] has completed. | 733 /// set after Future retuned by [run] has completed. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 754 ClassElement doubleClass; | 757 ClassElement doubleClass; |
| 755 ClassElement stringClass; | 758 ClassElement stringClass; |
| 756 ClassElement functionClass; | 759 ClassElement functionClass; |
| 757 ClassElement nullClass; | 760 ClassElement nullClass; |
| 758 ClassElement listClass; | 761 ClassElement listClass; |
| 759 ClassElement typeClass; | 762 ClassElement typeClass; |
| 760 ClassElement mapClass; | 763 ClassElement mapClass; |
| 761 ClassElement symbolClass; | 764 ClassElement symbolClass; |
| 762 ClassElement stackTraceClass; | 765 ClassElement stackTraceClass; |
| 763 ClassElement typedDataClass; | 766 ClassElement typedDataClass; |
| 767 ClassElement futureClass; |
| 768 ClassElement iterableClass; |
| 769 ClassElement streamClass; |
| 764 | 770 |
| 765 /// The constant for the [proxy] variable defined in dart:core. | 771 /// The constant for the [proxy] variable defined in dart:core. |
| 766 ConstantValue proxyConstant; | 772 ConstantValue proxyConstant; |
| 767 | 773 |
| 768 // TODO(johnniwinther): Move this to the JavaScriptBackend. | 774 // TODO(johnniwinther): Move this to the JavaScriptBackend. |
| 769 /// The constant for the [patch] variable defined in dart:_js_helper. | 775 /// The constant for the [patch] variable defined in dart:_js_helper. |
| 770 ConstantValue patchConstant; | 776 ConstantValue patchConstant; |
| 771 | 777 |
| 772 // TODO(johnniwinther): Move this to the JavaScriptBackend. | 778 // TODO(johnniwinther): Move this to the JavaScriptBackend. |
| 773 ClassElement nativeAnnotationClass; | 779 ClassElement nativeAnnotationClass; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 this.verbose: false, | 957 this.verbose: false, |
| 952 this.sourceMapUri: null, | 958 this.sourceMapUri: null, |
| 953 this.outputUri: null, | 959 this.outputUri: null, |
| 954 this.buildId: UNDETERMINED_BUILD_ID, | 960 this.buildId: UNDETERMINED_BUILD_ID, |
| 955 this.terseDiagnostics: false, | 961 this.terseDiagnostics: false, |
| 956 this.dumpInfo: false, | 962 this.dumpInfo: false, |
| 957 this.showPackageWarnings: false, | 963 this.showPackageWarnings: false, |
| 958 this.useContentSecurityPolicy: false, | 964 this.useContentSecurityPolicy: false, |
| 959 this.suppressWarnings: false, | 965 this.suppressWarnings: false, |
| 960 bool hasIncrementalSupport: false, | 966 bool hasIncrementalSupport: false, |
| 967 this.enableAsyncAwait: false, |
| 961 api.CompilerOutputProvider outputProvider, | 968 api.CompilerOutputProvider outputProvider, |
| 962 List<String> strips: const []}) | 969 List<String> strips: const []}) |
| 963 : this.disableTypeInferenceFlag = | 970 : this.disableTypeInferenceFlag = |
| 964 disableTypeInferenceFlag || !emitJavaScript, | 971 disableTypeInferenceFlag || !emitJavaScript, |
| 965 this.analyzeOnly = | 972 this.analyzeOnly = |
| 966 analyzeOnly || analyzeSignaturesOnly || analyzeAllFlag, | 973 analyzeOnly || analyzeSignaturesOnly || analyzeAllFlag, |
| 967 this.analyzeSignaturesOnly = analyzeSignaturesOnly, | 974 this.analyzeSignaturesOnly = analyzeSignaturesOnly, |
| 968 this.analyzeAllFlag = analyzeAllFlag, | 975 this.analyzeAllFlag = analyzeAllFlag, |
| 969 this.hasIncrementalSupport = hasIncrementalSupport, | 976 this.hasIncrementalSupport = hasIncrementalSupport, |
| 970 cacheStrategy = new CacheStrategy(hasIncrementalSupport), | 977 cacheStrategy = new CacheStrategy(hasIncrementalSupport), |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 if (node == CURRENT_ELEMENT_SPANNABLE) { | 1075 if (node == CURRENT_ELEMENT_SPANNABLE) { |
| 1069 node = currentElement; | 1076 node = currentElement; |
| 1070 } else if (node == NO_LOCATION_SPANNABLE) { | 1077 } else if (node == NO_LOCATION_SPANNABLE) { |
| 1071 if (currentElement == null) return null; | 1078 if (currentElement == null) return null; |
| 1072 node = currentElement; | 1079 node = currentElement; |
| 1073 } | 1080 } |
| 1074 if (node is SourceSpan) { | 1081 if (node is SourceSpan) { |
| 1075 return node; | 1082 return node; |
| 1076 } else if (node is Node) { | 1083 } else if (node is Node) { |
| 1077 return spanFromNode(node); | 1084 return spanFromNode(node); |
| 1085 } else if (node is TokenPair) { |
| 1086 return spanFromTokens(node.begin, node.end); |
| 1078 } else if (node is Token) { | 1087 } else if (node is Token) { |
| 1079 return spanFromTokens(node, node); | 1088 return spanFromTokens(node, node); |
| 1080 } else if (node is HInstruction) { | 1089 } else if (node is HInstruction) { |
| 1081 return spanFromHInstruction(node); | 1090 return spanFromHInstruction(node); |
| 1082 } else if (node is Element) { | 1091 } else if (node is Element) { |
| 1083 return spanFromElement(node); | 1092 return spanFromElement(node); |
| 1084 } else if (node is MetadataAnnotation) { | 1093 } else if (node is MetadataAnnotation) { |
| 1085 Uri uri = node.annotatedElement.compilationUnit.script.readableUri; | 1094 Uri uri = node.annotatedElement.compilationUnit.script.readableUri; |
| 1086 return spanFromTokens(node.beginToken, node.endToken, uri); | 1095 return spanFromTokens(node.beginToken, node.endToken, uri); |
| 1087 } else if (node is Local) { | 1096 } else if (node is Local) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1183 if (uri == DART_CORE) { | 1192 if (uri == DART_CORE) { |
| 1184 initializeCoreClasses(); | 1193 initializeCoreClasses(); |
| 1185 identicalFunction = coreLibrary.find('identical'); | 1194 identicalFunction = coreLibrary.find('identical'); |
| 1186 } else if (uri == DART_INTERNAL) { | 1195 } else if (uri == DART_INTERNAL) { |
| 1187 symbolImplementationClass = findRequiredElement(library, 'Symbol'); | 1196 symbolImplementationClass = findRequiredElement(library, 'Symbol'); |
| 1188 } else if (uri == DART_MIRRORS) { | 1197 } else if (uri == DART_MIRRORS) { |
| 1189 mirrorSystemClass = findRequiredElement(library, 'MirrorSystem'); | 1198 mirrorSystemClass = findRequiredElement(library, 'MirrorSystem'); |
| 1190 mirrorsUsedClass = findRequiredElement(library, 'MirrorsUsed'); | 1199 mirrorsUsedClass = findRequiredElement(library, 'MirrorsUsed'); |
| 1191 } else if (uri == DART_ASYNC) { | 1200 } else if (uri == DART_ASYNC) { |
| 1192 deferredLibraryClass = findRequiredElement(library, 'DeferredLibrary'); | 1201 deferredLibraryClass = findRequiredElement(library, 'DeferredLibrary'); |
| 1202 futureClass = findRequiredElement(library, 'Future'); |
| 1203 streamClass = findRequiredElement(library, 'Stream'); |
| 1193 } else if (uri == DART_NATIVE_TYPED_DATA) { | 1204 } else if (uri == DART_NATIVE_TYPED_DATA) { |
| 1194 typedDataClass = findRequiredElement(library, 'NativeTypedData'); | 1205 typedDataClass = findRequiredElement(library, 'NativeTypedData'); |
| 1195 } else if (uri == js_backend.JavaScriptBackend.DART_JS_HELPER) { | 1206 } else if (uri == js_backend.JavaScriptBackend.DART_JS_HELPER) { |
| 1196 nativeAnnotationClass = findRequiredElement(library, 'Native'); | 1207 nativeAnnotationClass = findRequiredElement(library, 'Native'); |
| 1197 } | 1208 } |
| 1198 return backend.onLibraryScanned(library, loader); | 1209 return backend.onLibraryScanned(library, loader); |
| 1199 } | 1210 } |
| 1200 | 1211 |
| 1201 /// This method is called when all new libraries loaded through | 1212 /// This method is called when all new libraries loaded through |
| 1202 /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports | 1213 /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 numClass = lookupCoreClass('num'); | 1290 numClass = lookupCoreClass('num'); |
| 1280 intClass = lookupCoreClass('int'); | 1291 intClass = lookupCoreClass('int'); |
| 1281 doubleClass = lookupCoreClass('double'); | 1292 doubleClass = lookupCoreClass('double'); |
| 1282 stringClass = lookupCoreClass('String'); | 1293 stringClass = lookupCoreClass('String'); |
| 1283 functionClass = lookupCoreClass('Function'); | 1294 functionClass = lookupCoreClass('Function'); |
| 1284 listClass = lookupCoreClass('List'); | 1295 listClass = lookupCoreClass('List'); |
| 1285 typeClass = lookupCoreClass('Type'); | 1296 typeClass = lookupCoreClass('Type'); |
| 1286 mapClass = lookupCoreClass('Map'); | 1297 mapClass = lookupCoreClass('Map'); |
| 1287 nullClass = lookupCoreClass('Null'); | 1298 nullClass = lookupCoreClass('Null'); |
| 1288 stackTraceClass = lookupCoreClass('StackTrace'); | 1299 stackTraceClass = lookupCoreClass('StackTrace'); |
| 1300 iterableClass = lookupCoreClass('Iterable'); |
| 1289 symbolClass = lookupCoreClass('Symbol'); | 1301 symbolClass = lookupCoreClass('Symbol'); |
| 1290 if (!missingCoreClasses.isEmpty) { | 1302 if (!missingCoreClasses.isEmpty) { |
| 1291 internalError(coreLibrary, | 1303 internalError(coreLibrary, |
| 1292 'dart:core library does not contain required classes: ' | 1304 'dart:core library does not contain required classes: ' |
| 1293 '$missingCoreClasses'); | 1305 '$missingCoreClasses'); |
| 1294 } | 1306 } |
| 1295 } | 1307 } |
| 1296 | 1308 |
| 1297 Element _unnamedListConstructor; | 1309 Element _unnamedListConstructor; |
| 1298 Element get unnamedListConstructor { | 1310 Element get unnamedListConstructor { |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2163 int warnings = 0; | 2175 int warnings = 0; |
| 2164 int hints = 0; | 2176 int hints = 0; |
| 2165 } | 2177 } |
| 2166 | 2178 |
| 2167 class GenericTask extends CompilerTask { | 2179 class GenericTask extends CompilerTask { |
| 2168 final String name; | 2180 final String name; |
| 2169 | 2181 |
| 2170 GenericTask(this.name, Compiler compiler) | 2182 GenericTask(this.name, Compiler compiler) |
| 2171 : super(compiler); | 2183 : super(compiler); |
| 2172 } | 2184 } |
| OLD | NEW |