internal static ValueTask <T> RewriteChildrenInternal <T>(
        this IRewriter <T> rewriter,
        Func <T, ValueTask <T> > transformer,
        T value,
        Box <ChunkStack <T> > chunks
        ) => rewriter.WithChildren(
        async(children, t) =>
    {
        var(r, v, f) = t;
        var changed  = false;
        for (var i = 0; i < children.Length; i++)
        {
            var child        = children.Span[i];
            var newChild     = await f(child).ConfigureAwait(false);
            children.Span[i] = newChild;
            changed         |= !ReferenceEquals(newChild, child);
        }

        if (changed)
        {
            return(r.SetChildren(children.Span, v));
        }
        return(v);
    },
        (rewriter, value, transformer),
        value,
        chunks
        );
    internal static T RewriteChildrenInternal <T>(
        this IRewriter <T> rewriter,
        Func <T, T> transformer,
        T value,
        ref ChunkStack <T> chunks
        ) => rewriter.WithChildren(
        (children, t) =>
    {
        var(r, v, f) = t;
        var changed  = false;
        for (var i = 0; i < children.Length; i++)
        {
            var child    = children[i];
            var newChild = f(child);
            children[i]  = newChild;
            changed     |= !ReferenceEquals(newChild, child);
        }

        if (changed)
        {
            return(r.SetChildren(children, v));
        }
        return(v);
    },
        (rewriter, value, transformer),
        value,
        ref chunks
        );