KT-12019 Highlighting of redundant 'if' statements (#871)
This commit is contained in:
committed by
Dmitry Jemerov
parent
cf56ac0305
commit
bb32c2d350
@@ -333,8 +333,15 @@ public class KtPsiUtil {
|
||||
}
|
||||
|
||||
public static boolean isTrueConstant(@Nullable KtExpression condition) {
|
||||
return (condition != null && condition.getNode().getElementType() == KtNodeTypes.BOOLEAN_CONSTANT &&
|
||||
condition.getNode().findChildByType(KtTokens.TRUE_KEYWORD) != null);
|
||||
return isBooleanConstant(condition) && condition.getNode().findChildByType(KtTokens.TRUE_KEYWORD) != null;
|
||||
}
|
||||
|
||||
public static boolean isFalseConstant(@Nullable KtExpression condition) {
|
||||
return isBooleanConstant(condition) && condition.getNode().findChildByType(KtTokens.FALSE_KEYWORD) != null;
|
||||
}
|
||||
|
||||
private static boolean isBooleanConstant(@Nullable KtExpression condition) {
|
||||
return condition != null && condition.getNode().getElementType() == KtNodeTypes.BOOLEAN_CONSTANT;
|
||||
}
|
||||
|
||||
public static boolean isAbstract(@NotNull KtDeclarationWithBody declaration) {
|
||||
|
||||
Reference in New Issue
Block a user