| Index: pkg/analyzer/lib/src/task/dart.dart
|
| diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart
|
| index 5eb259081e105c00890ee26bd60fcbca9d4d0561..ea97f7984a29ead1944bee6662bf382c3b6356af 100644
|
| --- a/pkg/analyzer/lib/src/task/dart.dart
|
| +++ b/pkg/analyzer/lib/src/task/dart.dart
|
| @@ -2597,15 +2597,7 @@ class DartErrorsTask extends SourceBasedAnalysisTask {
|
|
|
| LineInfo lineInfo = getRequiredInput(LINE_INFO_INPUT);
|
|
|
| - bool isIgnored(AnalysisError error) {
|
| - int errorLine = lineInfo.getLocation(error.offset).lineNumber;
|
| - String errorCode = error.errorCode.name.toLowerCase();
|
| - // Ignores can be on the line or just preceding the error.
|
| - return ignoreInfo.ignoredAt(errorCode, errorLine) ||
|
| - ignoreInfo.ignoredAt(errorCode, errorLine - 1);
|
| - }
|
| -
|
| - return errors.where((AnalysisError e) => !isIgnored(e)).toList();
|
| + return filterIgnored(errors, ignoreInfo, lineInfo);
|
| }
|
|
|
| /**
|
| @@ -2650,6 +2642,27 @@ class DartErrorsTask extends SourceBasedAnalysisTask {
|
| AnalysisContext context, AnalysisTarget target) {
|
| return new DartErrorsTask(context, target);
|
| }
|
| +
|
| + /**
|
| + * Return a new list with items from [errors] which are not filtered out by
|
| + * the [ignoreInfo].
|
| + */
|
| + static List<AnalysisError> filterIgnored(
|
| + List<AnalysisError> errors, IgnoreInfo ignoreInfo, LineInfo lineInfo) {
|
| + if (errors.isEmpty || !ignoreInfo.hasIgnores) {
|
| + return errors;
|
| + }
|
| +
|
| + bool isIgnored(AnalysisError error) {
|
| + int errorLine = lineInfo.getLocation(error.offset).lineNumber;
|
| + String errorCode = error.errorCode.name.toLowerCase();
|
| + // Ignores can be on the line or just preceding the error.
|
| + return ignoreInfo.ignoredAt(errorCode, errorLine) ||
|
| + ignoreInfo.ignoredAt(errorCode, errorLine - 1);
|
| + }
|
| +
|
| + return errors.where((AnalysisError e) => !isIgnored(e)).toList();
|
| + }
|
| }
|
|
|
| /**
|
|
|