codegen: Zero length of arrays when transferring ownership

This allows var data = (owned) aGenericArray.data;
without later setting data.len = 0 manually.