ComparisonBlock (@NotNull PsiStatement statement, @NotNull PsiVariable firstParam, @NotNull PsiVariable secondParam, @Nullable PsiVariable previousResult) { if (statement instanceof PsiDeclarationStatement declaration) { PsiElement[] elements = declaration.getDeclaredElements(); if (elements.length == 0) return null; PsiLocalVariable variable = tryCast(elements[0], PsiLocalVariable.class); if (variable == null) return null; PsiExpression initializer = PsiUtil.skipParenthesizedExprDown(variable.getInitializer()); return extractBlock(initializer, firstParam, secondParam, variable); } else if (previousResult != null && statement instanceof PsiExpressionStatement) { PsiExpression expr = ExpressionUtils.getAssignmentTo(((PsiExpressionStatement)statement).getExpression(), previousResult); return extractBlock(expr, firstParam, secondParam, previousResult); } return null; }