Chromium Code Reviews| Index: pkg/analyzer/lib/src/generated/source.dart |
| diff --git a/pkg/analyzer/lib/src/generated/source.dart b/pkg/analyzer/lib/src/generated/source.dart |
| index 4ba4c51a1060f86001605bdf29801a90cb7f9b0a..f66bc24cd9ffea81d7323a232a5c4a4e7e4fd1f3 100644 |
| --- a/pkg/analyzer/lib/src/generated/source.dart |
| +++ b/pkg/analyzer/lib/src/generated/source.dart |
| @@ -177,6 +177,36 @@ class DartUriResolver extends UriResolver { |
| } |
| /** |
| + * Information about analysis `//ignore:` comments within a source file. |
| + */ |
| +class IgnoreInfo { |
|
scheglov
2016/05/27 18:05:47
This could live in src/dart.dart
pquitslund
2016/05/27 21:50:53
Done.
|
| + final Map<int, List<String>> _ignoreMap = new HashMap<int, List<String>>(); |
| + |
| + /** |
| + * Map of line numbers to associated ignored error codes. |
| + */ |
| + Map<int, Iterable<String>> get ignores => _ignoreMap; |
| + |
| + /** |
| + * Ignore this [errorCode] at [line]. |
| + */ |
| + void add(int line, String errorCode) { |
| + _ignoreMap.putIfAbsent(line, () => new List<String>()).add(errorCode); |
| + } |
| + |
| + /** |
| + * Whether this info object defines any ignores. |
| + */ |
| + bool get hasIgnores => ignores.length > 0; |
|
scheglov
2016/05/27 18:05:47
=> ignores.isNotEmpty;
pquitslund
2016/05/27 21:50:53
Done.
|
| + |
| + /** |
| + * Test whether this [errorCode] is ignored at the given [line]. |
| + */ |
| + bool ignoredAt(String errorCode, int line) => |
| + _ignoreMap[line]?.contains(errorCode) == true; |
| +} |
| + |
| +/** |
| * Information about line and column information within a source file. |
| */ |
| class LineInfo { |