| 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.compiler_base; | 5 library dart2js.compiler_base; |
| 6 | 6 |
| 7 import 'dart:async' show EventSink, Future; | 7 import 'dart:async' show EventSink, Future; |
| 8 | 8 |
| 9 import '../compiler_new.dart' as api; | 9 import '../compiler_new.dart' as api; |
| 10 import 'cache_strategy.dart' show CacheStrategy; | 10 import 'cache_strategy.dart' show CacheStrategy; |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 // compile-time constants that are metadata. This means adding | 803 // compile-time constants that are metadata. This means adding |
| 804 // something to the resolution queue. So we cannot wait with | 804 // something to the resolution queue. So we cannot wait with |
| 805 // this until after the resolution queue is processed. | 805 // this until after the resolution queue is processed. |
| 806 deferredLoadTask.beforeResolution(this); | 806 deferredLoadTask.beforeResolution(this); |
| 807 impactStrategy = backend.createImpactStrategy( | 807 impactStrategy = backend.createImpactStrategy( |
| 808 supportDeferredLoad: deferredLoadTask.isProgramSplit, | 808 supportDeferredLoad: deferredLoadTask.isProgramSplit, |
| 809 supportDumpInfo: options.dumpInfo, | 809 supportDumpInfo: options.dumpInfo, |
| 810 supportSerialization: serialization.supportSerialization); | 810 supportSerialization: serialization.supportSerialization); |
| 811 | 811 |
| 812 phase = PHASE_RESOLVING; | 812 phase = PHASE_RESOLVING; |
| 813 if (analyzeAll) { | 813 if (options.resolveOnly) { |
| 814 libraryLoader.libraries.where((LibraryElement library) { |
| 815 return !serialization.isDeserialized(library); |
| 816 }).forEach((LibraryElement library) { |
| 817 reporter.log('Enqueuing ${library.canonicalUri}'); |
| 818 fullyEnqueueLibrary(library, enqueuer.resolution); |
| 819 }); |
| 820 } else if (analyzeAll) { |
| 814 libraryLoader.libraries.forEach((LibraryElement library) { | 821 libraryLoader.libraries.forEach((LibraryElement library) { |
| 815 reporter.log('Enqueuing ${library.canonicalUri}'); | 822 reporter.log('Enqueuing ${library.canonicalUri}'); |
| 816 fullyEnqueueLibrary(library, enqueuer.resolution); | 823 fullyEnqueueLibrary(library, enqueuer.resolution); |
| 817 }); | 824 }); |
| 818 } else if (options.analyzeMain) { | 825 } else if (options.analyzeMain) { |
| 819 if (mainApp != null) { | 826 if (mainApp != null) { |
| 820 fullyEnqueueLibrary(mainApp, enqueuer.resolution); | 827 fullyEnqueueLibrary(mainApp, enqueuer.resolution); |
| 821 } | 828 } |
| 822 if (librariesToAnalyzeWhenRun != null) { | 829 if (librariesToAnalyzeWhenRun != null) { |
| 823 for (Uri libraryUri in librariesToAnalyzeWhenRun) { | 830 for (Uri libraryUri in librariesToAnalyzeWhenRun) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 839 if (compilationFailed) { | 846 if (compilationFailed) { |
| 840 if (!options.generateCodeWithCompileTimeErrors) return; | 847 if (!options.generateCodeWithCompileTimeErrors) return; |
| 841 if (!backend | 848 if (!backend |
| 842 .enableCodegenWithErrorsIfSupported(NO_LOCATION_SPANNABLE)) { | 849 .enableCodegenWithErrorsIfSupported(NO_LOCATION_SPANNABLE)) { |
| 843 return; | 850 return; |
| 844 } | 851 } |
| 845 } | 852 } |
| 846 | 853 |
| 847 if (options.resolveOnly) { | 854 if (options.resolveOnly) { |
| 848 reporter.log('Serializing to ${options.resolutionOutput}'); | 855 reporter.log('Serializing to ${options.resolutionOutput}'); |
| 849 serialization.serializeToSink( | 856 serialization |
| 850 userOutputProvider.createEventSink('', 'data'), | 857 .serializeToSink(userOutputProvider.createEventSink('', 'data'), |
| 851 libraryLoader.libraries); | 858 libraryLoader.libraries.where((LibraryElement library) { |
| 859 return !serialization.isDeserialized(library); |
| 860 })); |
| 852 } | 861 } |
| 853 if (options.analyzeOnly) { | 862 if (options.analyzeOnly) { |
| 854 if (!analyzeAll && !compilationFailed) { | 863 if (!analyzeAll && !compilationFailed) { |
| 855 // No point in reporting unused code when [analyzeAll] is true: all | 864 // No point in reporting unused code when [analyzeAll] is true: all |
| 856 // code is artificially used. | 865 // code is artificially used. |
| 857 // If compilation failed, it is possible that the error prevents the | 866 // If compilation failed, it is possible that the error prevents the |
| 858 // compiler from analyzing all the code. | 867 // compiler from analyzing all the code. |
| 859 // TODO(johnniwinther): Reenable this when the reporting is more | 868 // TODO(johnniwinther): Reenable this when the reporting is more |
| 860 // precise. | 869 // precise. |
| 861 //reportUnusedCode(); | 870 //reportUnusedCode(); |
| (...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2104 _ElementScanner(this.scanner); | 2113 _ElementScanner(this.scanner); |
| 2105 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2114 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
| 2106 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2115 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
| 2107 } | 2116 } |
| 2108 | 2117 |
| 2109 class _EmptyEnvironment implements Environment { | 2118 class _EmptyEnvironment implements Environment { |
| 2110 const _EmptyEnvironment(); | 2119 const _EmptyEnvironment(); |
| 2111 | 2120 |
| 2112 String valueOf(String key) => null; | 2121 String valueOf(String key) => null; |
| 2113 } | 2122 } |
| OLD | NEW |