| 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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 /// `true` if enum declarations are supported. | 737 /// `true` if enum declarations are supported. |
| 738 final bool enableEnums; | 738 final bool enableEnums; |
| 739 | 739 |
| 740 /// If `true`, some values are cached for reuse in incremental compilation. | 740 /// If `true`, some values are cached for reuse in incremental compilation. |
| 741 /// Incremental compilation is basically calling [run] more than once. | 741 /// Incremental compilation is basically calling [run] more than once. |
| 742 final bool hasIncrementalSupport; | 742 final bool hasIncrementalSupport; |
| 743 | 743 |
| 744 /// If `true` native extension syntax is supported by the frontend. | 744 /// If `true` native extension syntax is supported by the frontend. |
| 745 final bool allowNativeExtensions; | 745 final bool allowNativeExtensions; |
| 746 | 746 |
| 747 api.CompilerOutputProvider outputProvider; | 747 /// Output provider from user of Compiler API. |
| 748 api.CompilerOutputProvider userOutputProvider; |
| 749 |
| 750 /// Generate output even when there are compile-time errors. |
| 751 final bool generateCodeWithCompileTimeErrors; |
| 748 | 752 |
| 749 bool disableInlining = false; | 753 bool disableInlining = false; |
| 750 | 754 |
| 751 List<Uri> librariesToAnalyzeWhenRun; | 755 List<Uri> librariesToAnalyzeWhenRun; |
| 752 | 756 |
| 753 Tracer tracer; | 757 Tracer tracer; |
| 754 | 758 |
| 755 CompilerTask measuredTask; | 759 CompilerTask measuredTask; |
| 756 Element _currentElement; | 760 Element _currentElement; |
| 757 LibraryElement coreLibrary; | 761 LibraryElement coreLibrary; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 this.deferredMapUri: null, | 995 this.deferredMapUri: null, |
| 992 this.dumpInfo: false, | 996 this.dumpInfo: false, |
| 993 this.showPackageWarnings: false, | 997 this.showPackageWarnings: false, |
| 994 this.useContentSecurityPolicy: false, | 998 this.useContentSecurityPolicy: false, |
| 995 this.suppressWarnings: false, | 999 this.suppressWarnings: false, |
| 996 bool hasIncrementalSupport: false, | 1000 bool hasIncrementalSupport: false, |
| 997 this.enableExperimentalMirrors: false, | 1001 this.enableExperimentalMirrors: false, |
| 998 this.enableAsyncAwait: false, | 1002 this.enableAsyncAwait: false, |
| 999 this.enableEnums: false, | 1003 this.enableEnums: false, |
| 1000 this.allowNativeExtensions: false, | 1004 this.allowNativeExtensions: false, |
| 1005 this.generateCodeWithCompileTimeErrors: false, |
| 1001 api.CompilerOutputProvider outputProvider, | 1006 api.CompilerOutputProvider outputProvider, |
| 1002 List<String> strips: const []}) | 1007 List<String> strips: const []}) |
| 1003 : this.disableTypeInferenceFlag = | 1008 : this.disableTypeInferenceFlag = |
| 1004 disableTypeInferenceFlag || !emitJavaScript, | 1009 disableTypeInferenceFlag || !emitJavaScript, |
| 1005 this.analyzeOnly = | 1010 this.analyzeOnly = |
| 1006 analyzeOnly || analyzeSignaturesOnly || analyzeAllFlag, | 1011 analyzeOnly || analyzeSignaturesOnly || analyzeAllFlag, |
| 1007 this.analyzeSignaturesOnly = analyzeSignaturesOnly, | 1012 this.analyzeSignaturesOnly = analyzeSignaturesOnly, |
| 1008 this.analyzeAllFlag = analyzeAllFlag, | 1013 this.analyzeAllFlag = analyzeAllFlag, |
| 1009 this.hasIncrementalSupport = hasIncrementalSupport, | 1014 this.hasIncrementalSupport = hasIncrementalSupport, |
| 1010 cacheStrategy = new CacheStrategy(hasIncrementalSupport), | 1015 cacheStrategy = new CacheStrategy(hasIncrementalSupport), |
| 1011 this.outputProvider = (outputProvider == null) | 1016 this.userOutputProvider = (outputProvider == null) |
| 1012 ? NullSink.outputProvider | 1017 ? NullSink.outputProvider |
| 1013 : outputProvider { | 1018 : outputProvider { |
| 1014 if (hasIncrementalSupport) { | 1019 if (hasIncrementalSupport) { |
| 1015 // TODO(ahe): This is too much. Any method from platform and package | 1020 // TODO(ahe): This is too much. Any method from platform and package |
| 1016 // libraries can be inlined. | 1021 // libraries can be inlined. |
| 1017 disableInlining = true; | 1022 disableInlining = true; |
| 1018 } | 1023 } |
| 1019 world = new World(this); | 1024 world = new World(this); |
| 1020 // TODO(johnniwinther): Initialize core types in [initializeCoreClasses] and | 1025 // TODO(johnniwinther): Initialize core types in [initializeCoreClasses] and |
| 1021 // make its field final. | 1026 // make its field final. |
| (...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2083 // TODO(ahe): It would be nice to reuse names of nested closures. | 2088 // TODO(ahe): It would be nice to reuse names of nested closures. |
| 2084 closureToClassMapper.forgetElement(closure); | 2089 closureToClassMapper.forgetElement(closure); |
| 2085 } | 2090 } |
| 2086 } | 2091 } |
| 2087 backend.forgetElement(element); | 2092 backend.forgetElement(element); |
| 2088 } | 2093 } |
| 2089 | 2094 |
| 2090 bool elementHasCompileTimeError(Element element) { | 2095 bool elementHasCompileTimeError(Element element) { |
| 2091 return elementsWithCompileTimeErrors.contains(element); | 2096 return elementsWithCompileTimeErrors.contains(element); |
| 2092 } | 2097 } |
| 2098 |
| 2099 EventSink<String> outputProvider(String name, String extension) { |
| 2100 if (compilationFailed) return new NullSink('$name.$extension'); |
| 2101 return userOutputProvider(name, extension); |
| 2102 } |
| 2093 } | 2103 } |
| 2094 | 2104 |
| 2095 class CompilerTask { | 2105 class CompilerTask { |
| 2096 final Compiler compiler; | 2106 final Compiler compiler; |
| 2097 final Stopwatch watch; | 2107 final Stopwatch watch; |
| 2098 UserTag profilerTag; | 2108 UserTag profilerTag; |
| 2099 | 2109 |
| 2100 CompilerTask(Compiler compiler) | 2110 CompilerTask(Compiler compiler) |
| 2101 : this.compiler = compiler, | 2111 : this.compiler = compiler, |
| 2102 watch = (compiler.verbose) ? new Stopwatch() : null; | 2112 watch = (compiler.verbose) ? new Stopwatch() : null; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2374 InterfaceType get nullType => nullClass.computeType(compiler); | 2384 InterfaceType get nullType => nullClass.computeType(compiler); |
| 2375 | 2385 |
| 2376 @override | 2386 @override |
| 2377 InterfaceType get numType => numClass.computeType(compiler); | 2387 InterfaceType get numType => numClass.computeType(compiler); |
| 2378 | 2388 |
| 2379 @override | 2389 @override |
| 2380 InterfaceType get stringType => stringClass.computeType(compiler); | 2390 InterfaceType get stringType => stringClass.computeType(compiler); |
| 2381 } | 2391 } |
| 2382 | 2392 |
| 2383 typedef void InternalErrorFunction(Spannable location, String message); | 2393 typedef void InternalErrorFunction(Spannable location, String message); |
| OLD | NEW |