| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 checker = new TypeCheckerTask(this), | 357 checker = new TypeCheckerTask(this), |
| 358 typesTask = new ti.TypesTask(this), | 358 typesTask = new ti.TypesTask(this), |
| 359 constants = backend.constantCompilerTask, | 359 constants = backend.constantCompilerTask, |
| 360 deferredLoadTask = new DeferredLoadTask(this), | 360 deferredLoadTask = new DeferredLoadTask(this), |
| 361 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), | 361 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), |
| 362 enqueuer = backend.makeEnqueuer(), | 362 enqueuer = backend.makeEnqueuer(), |
| 363 dumpInfoTask = new DumpInfoTask(this), | 363 dumpInfoTask = new DumpInfoTask(this), |
| 364 reuseLibraryTask = new GenericTask('Reuse library', this), | 364 reuseLibraryTask = new GenericTask('Reuse library', this), |
| 365 selfTask = new GenericTask('self', this), | 365 selfTask = new GenericTask('self', this), |
| 366 ]; | 366 ]; |
| 367 if (options.resolveOnly) { |
| 368 serialization.supportSerialization = true; |
| 369 } |
| 367 | 370 |
| 368 _parsingContext = | 371 _parsingContext = |
| 369 new ParsingContext(reporter, options, parser, patchParser, backend); | 372 new ParsingContext(reporter, options, parser, patchParser, backend); |
| 370 | 373 |
| 371 tasks.addAll(backend.tasks); | 374 tasks.addAll(backend.tasks); |
| 372 } | 375 } |
| 373 | 376 |
| 374 /// Creates the scanner task. | 377 /// Creates the scanner task. |
| 375 /// | 378 /// |
| 376 /// Override this to mock the scanner for testing. | 379 /// Override this to mock the scanner for testing. |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 _reporter.reportSuppressedMessagesSummary(); | 854 _reporter.reportSuppressedMessagesSummary(); |
| 852 | 855 |
| 853 if (compilationFailed) { | 856 if (compilationFailed) { |
| 854 if (!options.generateCodeWithCompileTimeErrors) return; | 857 if (!options.generateCodeWithCompileTimeErrors) return; |
| 855 if (!backend | 858 if (!backend |
| 856 .enableCodegenWithErrorsIfSupported(NO_LOCATION_SPANNABLE)) { | 859 .enableCodegenWithErrorsIfSupported(NO_LOCATION_SPANNABLE)) { |
| 857 return; | 860 return; |
| 858 } | 861 } |
| 859 } | 862 } |
| 860 | 863 |
| 864 if (options.resolveOnly) { |
| 865 reporter.log('Serializing to ${options.resolutionOutput}'); |
| 866 serialization.serializeToSink( |
| 867 userOutputProvider.createEventSink('', 'data'), |
| 868 libraryLoader.libraries); |
| 869 } |
| 861 if (options.analyzeOnly) { | 870 if (options.analyzeOnly) { |
| 862 if (!analyzeAll && !compilationFailed) { | 871 if (!analyzeAll && !compilationFailed) { |
| 863 // No point in reporting unused code when [analyzeAll] is true: all | 872 // No point in reporting unused code when [analyzeAll] is true: all |
| 864 // code is artificially used. | 873 // code is artificially used. |
| 865 // If compilation failed, it is possible that the error prevents the | 874 // If compilation failed, it is possible that the error prevents the |
| 866 // compiler from analyzing all the code. | 875 // compiler from analyzing all the code. |
| 867 // TODO(johnniwinther): Reenable this when the reporting is more | 876 // TODO(johnniwinther): Reenable this when the reporting is more |
| 868 // precise. | 877 // precise. |
| 869 //reportUnusedCode(); | 878 //reportUnusedCode(); |
| 870 } | 879 } |
| (...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2090 _ElementScanner(this.scanner); | 2099 _ElementScanner(this.scanner); |
| 2091 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2100 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
| 2092 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2101 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
| 2093 } | 2102 } |
| 2094 | 2103 |
| 2095 class _EmptyEnvironment implements Environment { | 2104 class _EmptyEnvironment implements Environment { |
| 2096 const _EmptyEnvironment(); | 2105 const _EmptyEnvironment(); |
| 2097 | 2106 |
| 2098 String valueOf(String key) => null; | 2107 String valueOf(String key) => null; |
| 2099 } | 2108 } |
| OLD | NEW |