+ BcVec *v = (BcVec*) n;
+ bool ref, ref_size;
+
+ ref = (v->size == sizeof(BcVec) && t != BC_TYPE_ARRAY);
+ ref_size = (v->size == sizeof(uint8_t));
+
+ if (ref || (ref_size && t == BC_TYPE_REF)) {
+ bc_vec_init(&r.d.v, sizeof(uint8_t), NULL);
+ if (ref) {
+ size_t vidx, idx;
+ BcId id;
+
+ id.name = ptr->d.id.name;
+ v = xc_program_search(ptr->d.id.name, BC_TYPE_REF);
+
+ // Make sure the pointer was not invalidated.
+ vec = xc_program_search(name, t);
+
+ vidx = bc_map_find_exact(&G.prog.arr_map, &id);
+ //assert(vidx != BC_VEC_INVALID_IDX);
+ vidx = ((BcId*) bc_vec_item(&G.prog.arr_map, vidx))->idx;
+ idx = v->len - 1;
+
+ bc_vec_pushIndex(&r.d.v, vidx);
+ bc_vec_pushIndex(&r.d.v, idx);
+ }
+ // If we get here, we are copying a ref to a ref.
+ else bc_vec_npush(&r.d.v, v->len, v->v);
+
+ // We need to return early.
+ goto ret;
+ }
+
+ if (ref_size && t != BC_TYPE_REF)
+ v = xc_program_dereference(v);
+