public static StackValue Repack(Obj obj, ProtoCore.DSASM.Heap heap) { if (obj.Type.IsIndexable) { //Unpack each of the elements DsasmArray arr = (DsasmArray)obj.Payload; StackValue[] sv = new StackValue[arr.members.Length]; //recurse over the array for (int i = 0; i < sv.Length; i++) sv[i] = Repack(arr.members[i], heap); int size = sv.Length; StackValue ptr = heap.AllocateArray(sv); return ptr; } // For non-arrays, there is nothing to repack so just return the original stackvalue return obj.DsasmValue; }