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

Unified Diff: pkg/analyzer/lib/src/dart/analysis/driver.dart

Issue 3002123002: Ignore missing error codes, but report them (Closed)
Patch Set: Created 3 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/analysis/driver.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 7b985333ef123675b6b455e343776b479c6596ab..e9b67d1a2e06dd41ca057d5bdf884b84c8e5b2ea 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -1219,7 +1219,8 @@ class AnalysisDriver implements AnalysisDriverGeneric {
*/
List<AnalysisError> _getErrorsFromSerialized(
FileState file, List<AnalysisDriverUnitError> serialized) {
- return serialized.map((error) {
+ List<AnalysisError> errors = <AnalysisError>[];
+ for (AnalysisDriverUnitError error in serialized) {
String errorName = error.uniqueName;
ErrorCode errorCode =
errorCodeByUniqueName(errorName) ?? _lintCodeByUniqueName(errorName);
@@ -1227,16 +1228,19 @@ class AnalysisDriver implements AnalysisDriverGeneric {
// This could fail because the error code is no longer defined, or, in
// the case of a lint rule, if the lint rule has been disabled since the
// errors were written.
- throw new StateError('No ErrorCode for $errorName in $file');
+ AnalysisEngine.instance.instrumentationService
+ .logError('No error code for "$error" in "$file"');
+ } else {
+ errors.add(new AnalysisError.forValues(
+ file.source,
+ error.offset,
+ error.length,
+ errorCode,
+ error.message,
+ error.correction.isEmpty ? null : error.correction));
}
- return new AnalysisError.forValues(
- file.source,
- error.offset,
- error.length,
- errorCode,
- error.message,
- error.correction.isEmpty ? null : error.correction);
- }).toList();
+ }
+ return errors;
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698