protected override ICode VisitNewArray(ExprNewArray e) {
     var ctx = e.Ctx;
     MethodInfo caGenDef;
     if (e.ElementType.IsValueType) {
         caGenDef = ((Func<int, int[]>)InternalFunctions.CreateArrayValueType<int>).Method.GetGenericMethodDefinition();
     } else {
         caGenDef = ((Func<int, object[]>)InternalFunctions.CreateArrayRefType<object>).Method.GetGenericMethodDefinition();
     }
     var mCreateArray = ctx.Module.Import(caGenDef).MakeGeneric(e.ElementType);
     var expr = new ExprCall(ctx, mCreateArray, null, e.ExprNumElements);
     return expr;
 }
 protected override ICode VisitNewArray(ExprNewArray e) {
     newArrayTypes.Add(e.Type);
     return base.VisitNewArray(e);
 }
Пример #3
0
 protected override ICode VisitNewArray(ExprNewArray e) {
     this.code.Append("new[");
     this.Visit(e.ExprNumElements);
     this.code.Append("]");
     return e;
 }
Пример #4
0
 protected override ICode VisitNewArray(ExprNewArray e) {
     throw new InvalidOperationException("Should never get here");
 }
Пример #5
0
 private Stmt NewArray(Instruction inst) {
     var exprNumElements = this.stack.Pop();
     var elementType = ((TypeReference)inst.Operand).FullResolve(this.ctx);
     var expr = new ExprNewArray(this.ctx, elementType, exprNumElements);
     return this.SsaLocalAssignment(expr);
 }