check method
void
check(
- DcqRegistry registry
)
Implementation
@override
void check(
DcqRegistry registry,
) {
registry.addSwitchStatement((node) {
final seen = <String>{};
for (final member in node.members) {
final source = switch (member) {
SwitchCase(:final expression) => expression.toSource(),
SwitchPatternCase(:final guardedPattern) => guardedPattern.toSource(),
SwitchDefault() => null,
};
if (source == null) continue;
if (!seen.add(source)) {
reportAtNode(member);
}
}
});
registry.addSwitchExpression((node) {
final seen = <String>{};
for (final member in node.cases) {
final source = member.guardedPattern.toSource();
if (!seen.add(source)) {
reportAtNode(member.guardedPattern);
}
}
});
}