public EXPRARRINIT CreateArrayInit(EXPRFLAG nFlags, CType pType, EXPR pOptionalArguments, EXPR pOptionalArgumentDimensions, int[] pDimSizes)
        {
            Debug.Assert(0 == (nFlags &
                               ~(EXPRFLAG.EXF_MASK_ANY | EXPRFLAG.EXF_ARRAYCONST | EXPRFLAG.EXF_ARRAYALLCONST)));
            EXPRARRINIT rval = new EXPRARRINIT();

            rval.kind = ExpressionKind.EK_ARRINIT;
            rval.type = pType;
            rval.SetOptionalArguments(pOptionalArguments);
            rval.SetOptionalArgumentDimensions(pOptionalArgumentDimensions);
            rval.dimSizes = pDimSizes;
            rval.dimSize  = pDimSizes != null ? pDimSizes.Length : 0;
            Debug.Assert(rval != null);
            return(rval);
        }
Esempio n. 2
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);
 }
        /////////////////////////////////////////////////////////////////////////////////

        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();
        }
Esempio n. 4
0
 protected virtual EXPR VisitARRINIT(EXPRARRINIT pExpr)
 {
     return VisitEXPR(pExpr);
 }
Esempio n. 5
0
 protected virtual EXPR VisitARRINIT(EXPRARRINIT pExpr)
 {
     return(VisitEXPR(pExpr));
 }
Esempio n. 6
0
 public EXPRARRINIT CreateArrayInit(EXPRFLAG nFlags, CType pType, EXPR pOptionalArguments, EXPR pOptionalArgumentDimensions, int[] pDimSizes)
 {
     Debug.Assert(0 == (nFlags &
                ~(EXPRFLAG.EXF_MASK_ANY | EXPRFLAG.EXF_ARRAYCONST | EXPRFLAG.EXF_ARRAYALLCONST)));
     EXPRARRINIT rval = new EXPRARRINIT();
     rval.kind = ExpressionKind.EK_ARRINIT;
     rval.type = pType;
     rval.SetOptionalArguments(pOptionalArguments);
     rval.SetOptionalArgumentDimensions(pOptionalArgumentDimensions);
     rval.dimSizes = pDimSizes;
     rval.dimSize = pDimSizes != null ? pDimSizes.Length : 0;
     Debug.Assert(rval != null);
     return (rval);
 }