Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: pkg/compiler/lib/src/compiler.dart

Issue 2690063002: Refactor CompilerOutput (Closed)
Patch Set: Cleanup. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 'closure.dart' as closureMapping show ClosureTask; 10 import 'closure.dart' as closureMapping show ClosureTask;
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 if (compilationFailed) { 651 if (compilationFailed) {
652 if (!options.generateCodeWithCompileTimeErrors) return; 652 if (!options.generateCodeWithCompileTimeErrors) return;
653 if (!backend 653 if (!backend
654 .enableCodegenWithErrorsIfSupported(NO_LOCATION_SPANNABLE)) { 654 .enableCodegenWithErrorsIfSupported(NO_LOCATION_SPANNABLE)) {
655 return; 655 return;
656 } 656 }
657 } 657 }
658 658
659 if (options.resolveOnly && !compilationFailed) { 659 if (options.resolveOnly && !compilationFailed) {
660 reporter.log('Serializing to ${options.resolutionOutput}'); 660 reporter.log('Serializing to ${options.resolutionOutput}');
661 serialization 661 serialization.serializeToSink(
662 .serializeToSink(userOutputProvider.createEventSink('', 'data'), 662 userOutputProvider.createOutputSink(
663 libraryLoader.libraries.where((LibraryElement library) { 663 '', 'data', api.OutputType.serialization_data),
664 libraryLoader.libraries.where((LibraryElement library) {
664 return !serialization.isDeserialized(library); 665 return !serialization.isDeserialized(library);
665 })); 666 }));
666 } 667 }
667 if (options.analyzeOnly) { 668 if (options.analyzeOnly) {
668 if (!analyzeAll && !compilationFailed) { 669 if (!analyzeAll && !compilationFailed) {
669 // No point in reporting unused code when [analyzeAll] is true: all 670 // No point in reporting unused code when [analyzeAll] is true: all
670 // code is artificially used. 671 // code is artificially used.
671 // If compilation failed, it is possible that the error prevents the 672 // If compilation failed, it is possible that the error prevents the
672 // compiler from analyzing all the code. 673 // compiler from analyzing all the code.
673 // TODO(johnniwinther): Reenable this when the reporting is more 674 // TODO(johnniwinther): Reenable this when the reporting is more
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 // TODO(zarah): Extend element model to represent compile-time 1075 // TODO(zarah): Extend element model to represent compile-time
1075 // errors instead of using a map. 1076 // errors instead of using a map.
1076 element = mainFunction; 1077 element = mainFunction;
1077 } 1078 }
1078 elementsWithCompileTimeErrors 1079 elementsWithCompileTimeErrors
1079 .putIfAbsent(element, () => <DiagnosticMessage>[]) 1080 .putIfAbsent(element, () => <DiagnosticMessage>[])
1080 .add(message); 1081 .add(message);
1081 } 1082 }
1082 } 1083 }
1083 1084
1084 EventSink<String> outputProvider(String name, String extension) { 1085 api.OutputSink outputProvider(
1086 String name, String extension, api.OutputType type) {
1085 if (compilationFailed) { 1087 if (compilationFailed) {
1086 if (!options.generateCodeWithCompileTimeErrors || options.testMode) { 1088 if (!options.generateCodeWithCompileTimeErrors || options.testMode) {
1087 // Disable output in test mode: The build bot currently uses the time 1089 // Disable output in test mode: The build bot currently uses the time
1088 // stamp of the generated file to determine whether the output is 1090 // stamp of the generated file to determine whether the output is
1089 // up-to-date. 1091 // up-to-date.
1090 return new NullSink('$name.$extension'); 1092 return NullSink.outputProvider(name, extension, type);
1091 } 1093 }
1092 } 1094 }
1093 return userOutputProvider.createEventSink(name, extension); 1095 return userOutputProvider.createOutputSink(name, extension, type);
1094 } 1096 }
1095 } 1097 }
1096 1098
1097 /// Information about suppressed warnings and hints for a given library. 1099 /// Information about suppressed warnings and hints for a given library.
1098 class SuppressionInfo { 1100 class SuppressionInfo {
1099 int warnings = 0; 1101 int warnings = 0;
1100 int hints = 0; 1102 int hints = 0;
1101 } 1103 }
1102 1104
1103 class _CompilerCommonElements extends CommonElementsMixin { 1105 class _CompilerCommonElements extends CommonElementsMixin {
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
2067 if (library != null && library.isSynthesized) { 2069 if (library != null && library.isSynthesized) {
2068 return null; 2070 return null;
2069 } 2071 }
2070 if (library == null && required) { 2072 if (library == null && required) {
2071 throw new SpannableAssertionFailure( 2073 throw new SpannableAssertionFailure(
2072 library, "The library '${uri}' was not found."); 2074 library, "The library '${uri}' was not found.");
2073 } 2075 }
2074 return library; 2076 return library;
2075 } 2077 }
2076 } 2078 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698