KtIfExpression (@Nullable KtExpression expression) { KtIfExpression ifExpression = PsiTreeUtil.getParentOfType(expression, KtIfExpression.class, true); if (ifExpression == null) return null; if (equalOrLastInBlock(ifExpression.getThen(), expression) || equalOrLastInBlock(ifExpression.getElse(), expression)) { return ifExpression; } return null; }