Пример #1
0
 protected override EXPR VisitARRINIT(EXPRARRINIT expr)
 {
     Debug.Assert(expr != null);
     Debug.Assert(alwaysRewrite || currentAnonMeth != null);
     // POSSIBLE ERROR: Multi-d should be an error?
     EXPR pTypeOf = CreateTypeOf(expr.type.AsArrayType().GetElementType());
     EXPR args = GenerateArgsList(expr.GetOptionalArguments());
     EXPR Params = GenerateParamsArray(args, PredefinedType.PT_EXPRESSION);
     return GenerateCall(PREDEFMETH.PM_EXPRESSION_NEWARRAYINIT, pTypeOf, Params);
 }
Пример #2
0
        /////////////////////////////////////////////////////////////////////////////////

        private Expression[] GetArgumentsFromArrayInit(EXPRARRINIT arrinit)
        {
            List<Expression> expressions = new List<Expression>();

            if (arrinit != null)
            {
                EXPR list = arrinit.GetOptionalArguments();
                EXPR p = list;
                while (list != null)
                {
                    if (list.isLIST())
                    {
                        p = list.asLIST().GetOptionalElement();
                        list = list.asLIST().GetOptionalNextListNode();
                    }
                    else
                    {
                        p = list;
                        list = null;
                    }
                    expressions.Add(GetExpression(p));
                }

                Debug.Assert(expressions.Count == arrinit.dimSizes[0]);
            }
            return expressions.ToArray();
        }