check method
void
check(
- DcqRegistry registry
)
Implementation
@override
void check(
DcqRegistry registry,
) {
registry.addMethodDeclaration((node) {
final body = node.body;
if (body is! ExpressionFunctionBody) return;
if (body.expression is! SetOrMapLiteral) return;
final returnType = node.returnType;
if (returnType == null || _isVoidType(returnType)) {
reportAtNode(body.expression);
}
});
registry.addFunctionDeclaration((node) {
final body = node.functionExpression.body;
if (body is! ExpressionFunctionBody) return;
if (body.expression is! SetOrMapLiteral) return;
final returnType = node.returnType;
if (returnType == null || _isVoidType(returnType)) {
reportAtNode(body.expression);
}
});
registry.addFunctionExpression((node) {
if (node.parent is FunctionDeclaration) return;
final body = node.body;
if (body is! ExpressionFunctionBody) return;
if (body.expression is! SetOrMapLiteral) return;
final funcType = node.staticType;
if (funcType is FunctionType && funcType.returnType is VoidType) {
reportAtNode(body.expression);
}
});
}