boolean (PsiStatement statement) { if (!(statement instanceof PsiIfStatement)) return false; PsiExpression condition = ((PsiIfStatement)statement).getCondition(); if (condition == null) return false; if (BoolUtils.isNegation(condition)) { condition = BoolUtils.getNegated(condition); } if (condition instanceof PsiBinaryExpression) { condition = ((PsiBinaryExpression)condition).getLOperand(); } if (!(condition instanceof PsiReferenceExpression ref)) return false; return ref.getQualifierExpression() == null && (Objects.equals(myFinishedVariable, ref.getReferenceName()) || Objects.equals(myReturnVariable, ref.getReferenceName())); }