void EmitRead_CreateInstance(SerializerCodeGen g, Local valueArr, Local[] lengths, Operand optionalOutOldFirstDimLength, Local outResult) { using (g.ctx.StartDebugBlockAuto(this)) { if (AppendToCollection) { g.If(valueArr.AsOperand != null); { g.AssignAdd(lengths[0], optionalOutOldFirstDimLength.Assign(valueArr.AsOperand.Invoke("GetLength", 0))); } g.End(); } g.Assign(outResult, g.ExpressionFactory.NewArray(_itemType, lengths.Select(l => (Operand)l.AsOperand).ToArray())); g.Reader.NoteObject(outResult); if (AppendToCollection) { g.If(valueArr.AsOperand != null && optionalOutOldFirstDimLength > 0); { g.Invoke(typeof(Array), "Copy", valueArr, outResult, valueArr.AsOperand.Property("Length")); } g.End(); } } }
void EmitRead_CreateInstance(SerializerCodeGen g, Local value, Operand appendCount, Local reservedTrap, Local outOldLen, Local outResult) { using (g.ctx.StartDebugBlockAuto(this)) { g.Assign(outOldLen, AppendToCollection ? (value.AsOperand != null).Conditional(value.AsOperand.Property("Length"), 0) : (Operand)0); g.Assign(outResult, g.ExpressionFactory.NewArray(_itemType, outOldLen + appendCount)); if (!reservedTrap.IsNullRef()) { g.Reader.NoteReservedTrappedObject(reservedTrap, outResult); } else { g.Reader.NoteObject(outResult); } g.If(outOldLen.AsOperand != 0); { g.Invoke(value, "CopyTo", outResult, 0); } g.End(); } }