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

Unified Diff: pkg/analyzer/lib/src/task/strong/checker.dart

Issue 2784473004: Take analysis options into account when computing the severity of a strong mode "error". (Closed)
Patch Set: Add test cases. Created 3 years, 9 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 | « no previous file | pkg/analyzer/test/generated/hint_code_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/strong/checker.dart
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index 695e6ddfd8607896520a19dc8bfc75e388dc1597..463a5c2ce22853a0ea2babc5a06cd94d1b600e59 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -14,6 +14,7 @@ import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/source/error_processor.dart' show ErrorProcessor;
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/error/codes.dart' show StrongModeCode;
@@ -1038,7 +1039,14 @@ class CodeChecker extends RecursiveAstVisitor {
}
void _recordMessage(AstNode node, ErrorCode errorCode, List arguments) {
- var severity = errorCode.errorSeverity;
+ // Compute the right severity taking the analysis options into account.
+ // We construct a dummy error to make the common case where we end up
+ // ignoring the strong mode message cheaper.
+ var processor = ErrorProcessor.getProcessor(_options,
+ new AnalysisError.forValues(null, -1, 0, errorCode, null, null));
+ var severity =
+ (processor != null) ? processor.severity : errorCode.errorSeverity;
+
if (severity == ErrorSeverity.ERROR) _failure = true;
if (severity != ErrorSeverity.INFO || _options.strongModeHints) {
int begin = node is AnnotatedNode
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/hint_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698