check method
void
check(
- DcqRegistry registry
)
Implementation
@override
void check(
DcqRegistry registry,
) {
registry.addIfStatement((node) {
if (_isNestedElseIf(node)) return;
final branches = _collectBranches(node);
if (branches.length < 2) return;
final firstTarget = _getIsCheckTarget(branches.first);
if (firstTarget == null) return;
if (!_isSealedType(firstTarget.staticType)) return;
var allMatch = true;
for (final branch in branches.skip(1)) {
final target = _getIsCheckTarget(branch);
if (target == null || target.toSource() != firstTarget.toSource()) {
allMatch = false;
break;
}
}
if (allMatch) {
reportAtNode(node);
}
});
}