boolean (@NotNull PsiExpression expression, @NotNull PsiElement statementParent) { if (statementParent instanceof PsiIfStatement) { PsiStatement elseBranch = ((PsiIfStatement)statementParent).getElseBranch(); if (elseBranch != null && elseBranch.getFirstChild() == expression) { return true; } } return false; }