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

Unified Diff: pkg/analyzer_cli/lib/src/analyzer_impl.dart

Issue 1861363002: Add hooks for changing priorities of warnings to errors in strong mode (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/analyzer/lib/src/generated/error.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_cli/lib/src/analyzer_impl.dart
diff --git a/pkg/analyzer_cli/lib/src/analyzer_impl.dart b/pkg/analyzer_cli/lib/src/analyzer_impl.dart
index 428869ff2400d1fe821568db6a13e1ec4c9e57d5..e6f13707d40170bec535ed57c8c5e1cfd4f4a5f3 100644
--- a/pkg/analyzer_cli/lib/src/analyzer_impl.dart
+++ b/pkg/analyzer_cli/lib/src/analyzer_impl.dart
@@ -254,27 +254,28 @@ class AnalyzerImpl {
static ErrorSeverity computeSeverity(
AnalysisError error, CommandLineOptions options,
[AnalysisContext context]) {
+ bool isStrongMode = false;
if (context != null) {
ErrorProcessor processor = ErrorProcessor.getProcessor(context, error);
// If there is a processor for this error, defer to it.
if (processor != null) {
return processor.severity;
}
+ isStrongMode = context.analysisOptions.strongMode;
}
if (!options.enableTypeChecks &&
error.errorCode.type == ErrorType.CHECKED_MODE_COMPILE_TIME_ERROR) {
return ErrorSeverity.INFO;
- }
-
- if (options.hintsAreFatal && error.errorCode is HintCode) {
+ } else if (options.hintsAreFatal && error.errorCode is HintCode) {
return ErrorSeverity.ERROR;
- }
-
- if (options.lintsAreFatal && error.errorCode is LintCode) {
+ } else if (options.lintsAreFatal && error.errorCode is LintCode) {
+ return ErrorSeverity.ERROR;
+ } else if (isStrongMode &&
+ error is StaticWarningCode &&
+ (error as StaticWarningCode).isStrongModeError) {
return ErrorSeverity.ERROR;
}
-
return error.errorCode.errorSeverity;
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698