public static void replaceAssignmentsWithPatternVariables(@NotNull RootStatement statement, @NotNull StructClass structClass) {
    if (!structClass.hasPatternsInInstanceofSupport()) return;
    boolean recordPatternSupport = structClass.hasRecordPatternSupport();
    List<TempVarAssignmentItem> tempVarAssignments = new ArrayList<>();

    List<Runnable> runnables = replaceAssignmentsWithPatternVariables(statement, new HashSet<>(), tempVarAssignments, recordPatternSupport);
    if (runnables.isEmpty() || !SwitchHelper.checkAssignmentsToDelete(statement, tempVarAssignments)) {
      return;
    }
    for (Runnable runnable : runnables) {
      runnable.run();
    }
    removeTempVariableDeclarations(tempVarAssignments);
  }
public static void replaceAssignmentsWithPatternVariables(@NotNull RootStatement statement, @NotNull StructClass structClass)