| 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);
|
| }
|
| }
|
|
|