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

Unified Diff: pkg/compiler/lib/src/compiler.dart

Issue 1167353003: Opt-in to generate code for compile-time error. Only supported for SSA. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/apiimpl.dart ('k') | pkg/compiler/lib/src/dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/compiler.dart
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 2565f3097bc19f64cce6aff347f3b263e811fb29..93fc66a315304d01daa47bf774b8f0440ddb3f3b 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -302,8 +302,6 @@ abstract class Backend {
List<CompilerTask> get tasks;
- bool get canHandleCompilationFailed;
-
void onResolutionComplete() {}
void onTypeInferenceComplete() {}
@@ -314,9 +312,13 @@ abstract class Backend {
bool classNeedsRti(ClassElement cls);
bool methodNeedsRti(FunctionElement function);
- /// Register deferred loading. Returns `true` if the backend supports deferred
+ /// Enable compilation of code with compile time errors. Returns `true` if
+ /// supported by the backend.
+ bool enableCodegenWithErrorsIfSupported(Spannable node);
+
+ /// Enable deferred loading. Returns `true` if the backend supports deferred
/// loading.
- bool registerDeferredLoading(Spannable node, Registry registry);
+ bool enableDeferredLoadingIfSupported(Spannable node, Registry registry);
/// Called during codegen when [constant] has been used.
void registerCompileTimeConstant(ConstantValue constant, Registry registry) {}
@@ -794,6 +796,9 @@ abstract class Compiler implements DiagnosticListener {
/// Generate output even when there are compile-time errors.
final bool generateCodeWithCompileTimeErrors;
+ /// The compiler is run from the build bot.
+ final bool testMode;
+
bool disableInlining = false;
List<Uri> librariesToAnalyzeWhenRun;
@@ -1053,6 +1058,7 @@ abstract class Compiler implements DiagnosticListener {
this.allowNativeExtensions: false,
this.enableNullAwareOperators: false,
this.generateCodeWithCompileTimeErrors: false,
+ this.testMode: false,
api.CompilerOutputProvider outputProvider,
List<String> strips: const []})
: this.disableTypeInferenceFlag =
@@ -1621,9 +1627,11 @@ abstract class Compiler implements DiagnosticListener {
});
}
- // TODO(sigurdm): The dart backend should handle failed compilations.
- if (compilationFailed && !backend.canHandleCompilationFailed) {
- return;
+ if (compilationFailed){
+ if (!generateCodeWithCompileTimeErrors) return;
+ if (!backend.enableCodegenWithErrorsIfSupported(NO_LOCATION_SPANNABLE)) {
+ return;
+ }
}
if (analyzeOnly) {
@@ -2159,7 +2167,14 @@ abstract class Compiler implements DiagnosticListener {
}
EventSink<String> outputProvider(String name, String extension) {
- if (compilationFailed) return new NullSink('$name.$extension');
+ if (compilationFailed) {
+ if (!generateCodeWithCompileTimeErrors || testMode) {
+ // Disable output in test mode: The build bot currently uses the time
+ // stamp of the generated file to determine whether the output is
+ // up-to-date.
+ return new NullSink('$name.$extension');
+ }
+ }
return userOutputProvider(name, extension);
}
}
« no previous file with comments | « pkg/compiler/lib/src/apiimpl.dart ('k') | pkg/compiler/lib/src/dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698