length += 1;
    public Tree[] flatten(Tree[] trees) {        boolean copy = false;        int length = trees.length;        for (int i = 0; i < trees.length; i++) {            switch (trees[i]) {            case Empty:                copy = true;                length -= 1;                continue;            case Block(Tree[] stats):                if (stats.length == 0) continue; // preserve unit literals                copy = true;                length += stats.length;                continue;            }        }        if (!copy) return trees;        Tree[] clone = new Tree[length];        for (int i = 0, o = 0; i < trees.length; i++) {            switch (trees[i]) {            case Empty:                continue;            case Block(Tree[] stats):                if (stats.length == 0) break; // preserve unit literals                for (int j = 0; j < stats.length; j++) clone[o++] = stats[j];                continue;            }            clone[o++] = trees[i];        }        return clone;    }