Suppression constructor
Suppression(
- String content,
- LineInfo info
Initialize a newly created Suppression with the given content
and info
.
Implementation
Suppression(String content, LineInfo info) {
for (final match in _ignoreMatchers.allMatches(content)) {
final ids = match.group(1)!.split(',').map(_canonicalize);
final location = info.getLocation(match.start);
final lineNumber = location.lineNumber;
final beforeMatch = content.substring(
info.getOffsetOfLine(lineNumber - 1),
info.getOffsetOfLine(lineNumber - 1) + location.columnNumber - 1,
);
// If comment sits next to code, so it refers to its own line, otherwise it refers to the next line.
final ignoredNextLine = beforeMatch.trim().isEmpty;
_ignoreMap
.putIfAbsent(
ignoredNextLine ? lineNumber + 1 : lineNumber,
() => <String>[],
)
.addAll(ids);
}
for (final match in _ignoreForFileMatcher.allMatches(content)) {
_ignoreForFileSet.addAll(match.group(1)!.split(',').map(_canonicalize));
}
}