Ejemplo n.º 1
0
 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));
     }
 }
Ejemplo n.º 2
0
        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());
            }
        }
Ejemplo n.º 3
0
 public void EmitTypeAs(Type type)
 {
     Emit(InstructionFactory.GetFactory(type).TypeAs());
 }
Ejemplo n.º 4
0
 public void EmitDefaultValue(Type type)
 {
     Emit(InstructionFactory.GetFactory(type).DefaultValue());
 }
Ejemplo n.º 5
0
 public void EmitNewArray(Type elementType)
 {
     Emit(InstructionFactory.GetFactory(elementType).NewArray());
 }