void EmitPackedArrayInit(IType type, ExpressionCollection items)
{
byte[] ba = CreateByteArrayFromLiteralCollection(type, items);
if (null == ba)
{
EmitInlineArrayInit(type, items);
return;
}
FieldBuilder fb;
if (!_packedArrays.TryGetValue(ba, out fb))
{
//there is no previously emitted bytearray to reuse, create it then
fb = _moduleBuilder.DefineInitializedData(Context.GetUniqueName("newarr"), ba, FieldAttributes.Private);
_packedArrays.Add(ba, fb);
}
Dup(); //dup (newarr)
_il.Emit(OpCodes.Ldtoken, fb);
Call(RuntimeHelpers_InitializeArray);
}