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

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

Issue 1402813005: move strong mode hints behind flag (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/src/task/dart_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 26a6633d756ea9f25a0047d882a4f5075fe54e94..d1ebb6b1718b045a720a634e9edfa557c143975f 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -327,6 +327,8 @@ class CodeChecker extends RecursiveAstVisitor {
final TypeRules rules;
final AnalysisErrorListener reporter;
final _OverrideChecker _overrideChecker;
+ final bool _hints;
+
bool _failure = false;
bool get failure => _failure || _overrideChecker._failure;
@@ -335,9 +337,11 @@ class CodeChecker extends RecursiveAstVisitor {
_overrideChecker._failure = false;
}
- CodeChecker(TypeRules rules, AnalysisErrorListener reporter)
+ CodeChecker(TypeRules rules, AnalysisErrorListener reporter,
+ {bool hints: false})
: rules = rules,
reporter = reporter,
+ _hints = hints,
_overrideChecker = new _OverrideChecker(rules, reporter);
@override
@@ -924,7 +928,9 @@ class CodeChecker extends RecursiveAstVisitor {
}
void _recordDynamicInvoke(AstNode node, AstNode target) {
- reporter.onError(new DynamicInvoke(rules, node).toAnalysisError());
+ if (_hints) {
+ reporter.onError(new DynamicInvoke(rules, node).toAnalysisError());
+ }
// TODO(jmesserly): we may eventually want to record if the whole operation
// (node) was dynamic, rather than the target, but this is an easier fit
// with what we used to do.
@@ -934,8 +940,12 @@ class CodeChecker extends RecursiveAstVisitor {
void _recordMessage(StaticInfo info) {
if (info == null) return;
var error = info.toAnalysisError();
- if (error.errorCode.errorSeverity == ErrorSeverity.ERROR) _failure = true;
- reporter.onError(error);
+
+ var severity = error.errorCode.errorSeverity;
+ if (severity == ErrorSeverity.ERROR) _failure = true;
+ if (severity != ErrorSeverity.INFO || _hints) {
+ reporter.onError(error);
+ }
if (info is CoercionInfo) {
// TODO(jmesserly): if we're run again on the same AST, we'll produce the
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698