Index: pkg/compiler/lib/src/compiler.dart |
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart |
index 3b98b92e0506283af7288b3a5aa5386f6eafb22d..6e7228a34a42f54347d17d0947362217164213a2 100644 |
--- a/pkg/compiler/lib/src/compiler.dart |
+++ b/pkg/compiler/lib/src/compiler.dart |
@@ -1250,6 +1250,29 @@ abstract class Compiler { |
_reporter.onCrashInUserCode(message, exception, stackTrace); |
} |
+ /// Messages for which compile-time errors are reported but compilation |
+ /// continues regardless. |
+ static const List<MessageKind> BENIGN_ERRORS = const <MessageKind>[ |
+ MessageKind.INVALID_METADATA, |
+ MessageKind.INVALID_METADATA_GENERIC, |
+ ]; |
+ |
+ bool markCompilationAsFailed(DiagnosticMessage message, api.Diagnostic kind) { |
+ if (testMode) { |
+ // When in test mode, i.e. on the build-bot, we always stop compilation. |
+ return true; |
+ } |
+ return !BENIGN_ERRORS.contains(message.message.kind); |
+ } |
+ |
+ void fatalDiagnosticReported(DiagnosticMessage message, |
+ List<DiagnosticMessage> infos, |
+ api.Diagnostic kind) { |
+ if (markCompilationAsFailed(message, kind)) { |
+ compilationFailed = true; |
+ } |
+ } |
+ |
/** |
* Translates the [resolvedUri] into a readable URI. |
* |
@@ -1701,13 +1724,13 @@ class _CompilerDiagnosticReporter extends DiagnosticReporter { |
void reportDiagnostic(DiagnosticMessage message, |
List<DiagnosticMessage> infos, |
api.Diagnostic kind) { |
+ compiler.reportDiagnostic(message, infos, kind); |
if (kind == api.Diagnostic.ERROR || |
kind == api.Diagnostic.CRASH || |
(options.fatalWarnings && |
Siggi Cherem (dart-lang)
2015/12/15 00:51:40
maybe benign errors should continue to cause a fai
Johnni Winther
2015/12/15 09:04:20
Done.
|
kind == api.Diagnostic.WARNING)) { |
- compiler.compilationFailed = true; |
+ compiler.fatalDiagnosticReported(message, infos, kind); |
} |
- compiler.reportDiagnostic(message, infos, kind); |
} |
/** |