private void invoke(@NotNull PsiExpression initializer) {
      PsiVariable origVar = initializer.getParent() instanceof PsiVariable v ? v:
                            initializer.getParent() instanceof PsiAssignmentExpression assignment &&
                            assignment.getLExpression() instanceof PsiReferenceExpression ref && 
                            ref.resolve() instanceof PsiVariable v ? v : null;
      List<PsiExpression> sideEffects = SideEffectChecker.extractSideEffectExpressions(
        initializer, e -> e instanceof PsiUnaryExpression unary && ExpressionUtils.isReferenceTo(unary.getOperand(), origVar) ||
                          e instanceof PsiAssignmentExpression assignment &&
                          ExpressionUtils.isReferenceTo(assignment.getLExpression(), origVar));
      CodeBlockSurrounder.SurroundResult result = null;
      if (!sideEffects.isEmpty()) {
        PsiStatement[] statements = StatementExtractor.generateStatements(sideEffects, initializer);
        CodeBlockSurrounder surrounder = CodeBlockSurrounder.forExpression(initializer);
        if (surrounder == null) {
          tryProcessExpressionList(initializer, sideEffects);
          return;
        }
        result = surrounder.surround();
        PsiStatement anchor = result.getAnchor();
        initializer = result.getExpression();
        if (statements.length > 0) {
          BlockUtils.addBefore(anchor, statements);
        }
      }
      PsiElement parent = initializer.getParent();
      if (parent instanceof PsiVariable var) {
        initializer.delete();
        if (myAction != null) {
          myAction.accept(var);
        }
      } else if (parent instanceof PsiAssignmentExpression) {
        RemoveUnusedVariableUtil.deleteWholeStatement(parent);
      }
      if (result != null) {
        result.collapse();
      }
    }
private void invoke(@NotNull PsiExpression initializer)