public void EmitNewArrayInit(Type elementType, int elementCount) { // To avoid lock contention in InstructionFactory.GetFactory, we special case the most common // types of arrays that the compiler creates. if (elementType == typeof(CommandParameterInternal)) { Emit(InstructionFactory <CommandParameterInternal> .Factory.NewArrayInit(elementCount)); } else if (elementType == typeof(CommandParameterInternal[])) { Emit(InstructionFactory <CommandParameterInternal[]> .Factory.NewArrayInit(elementCount)); } else if (elementType == typeof(object)) { Emit(InstructionFactory <object> .Factory.NewArrayInit(elementCount)); } else if (elementType == typeof(string)) { Emit(InstructionFactory <string> .Factory.NewArrayInit(elementCount)); } else { Emit(InstructionFactory.GetFactory(elementType).NewArrayInit(elementCount)); } }
public void EmitSetArrayItem(Type arrayType) { var elementType = arrayType.GetElementType(); if (elementType.IsClass || elementType.IsInterface) { Emit(InstructionFactory <object> .Factory.SetArrayItem()); } else { Emit(InstructionFactory.GetFactory(elementType).SetArrayItem()); } }
public void EmitTypeAs(Type type) { Emit(InstructionFactory.GetFactory(type).TypeAs()); }
public void EmitDefaultValue(Type type) { Emit(InstructionFactory.GetFactory(type).DefaultValue()); }
public void EmitNewArray(Type elementType) { Emit(InstructionFactory.GetFactory(elementType).NewArray()); }