check method

  1. @override
void check(
  1. DcqRegistry registry
)

Implementation

@override
void check(
  DcqRegistry registry,
) {
  registry.addBinaryExpression((node) {
    final operatorType = node.operator.type;
    if (operatorType != TokenType.AMPERSAND_AMPERSAND &&
        operatorType != TokenType.BAR_BAR) {
      return;
    }

    final left = node.leftOperand.unParenthesized;
    final right = node.rightOperand.unParenthesized;

    if (left is BooleanLiteral) {
      reportAtNode(left);
    }
    if (right is BooleanLiteral) {
      reportAtNode(right);
    }
  });
}