PsiStatement (@Nullable PsiStatement statement, @NotNull PsiVariable last) { PsiIfStatement ifStatement = tryCast(statement, PsiIfStatement.class); if (ifStatement == null || ifStatement.getElseBranch() != null) return null; PsiBinaryExpression binOp = tryCast(ifStatement.getCondition(), PsiBinaryExpression.class); if (binOp == null) return null; PsiExpression maybeResult = ExpressionUtils.getValueComparedWithZero(binOp); if (!ExpressionUtils.isReferenceTo(maybeResult, last)) return null; return ControlFlowUtils.stripBraces(ifStatement.getThenBranch()); }