use of org.sonar.uast.helpers.ParenthesizedLike in project sonar-go by SonarSource.
the class CognitiveComplexity method flattenBinaryExpressions.
private static void flattenBinaryExpressions(UastNode node, List<BinaryExpressionLike> expressionAsList) {
ParenthesizedLike parenthesizedNode = ParenthesizedLike.from(node);
if (parenthesizedNode != null) {
flattenBinaryExpressions(parenthesizedNode.expression(), expressionAsList);
return;
}
BinaryExpressionLike binaryExpression = BinaryExpressionLike.from(node);
if (binaryExpression != null && logicalOperatorKind(binaryExpression) != null) {
flattenBinaryExpressions(binaryExpression.leftOperand(), expressionAsList);
expressionAsList.add(binaryExpression);
flattenBinaryExpressions(binaryExpression.rightOperand(), expressionAsList);
}
}
Aggregations