Пример #1
0
        public override void Visit(Model.Bytecode.CreateArrayInstruction instruction)
        {
            Cecil.ArrayType cilArrayType = referenceGenerator.TypeReference(instruction.Type) as Cecil.ArrayType;

            Mono.Cecil.Cil.Instruction cilIns = null;
            if (!instruction.Type.IsVector)
            {
                Cecil.MethodReference arrayCtor = ArrayHelper.ArrayCtor(cilArrayType as Cecil.ArrayType);
                cilIns = processor.Create(Mono.Cecil.Cil.OpCodes.Newobj, arrayCtor);
            }
            else
            {
                cilIns = processor.Create(Mono.Cecil.Cil.OpCodes.Newarr, cilArrayType.ElementType);
            }

            Result = new List <Mono.Cecil.Cil.Instruction>()
            {
                cilIns
            };
        }