Beispiel #1
0
        Bpl.Expr ArrayLength(Bpl.IToken tok, Bpl.Expr arr, int totalDims, int dim)
        {
            Contract.Requires(tok != null);
            Contract.Requires(arr != null);
            Contract.Requires(1 <= totalDims);
            Contract.Requires(0 <= dim && dim < totalDims);

            string name = "_System." + BuiltIns.ArrayClassName(totalDims) + ".Length";

            if (totalDims != 1)
            {
                name += dim;
            }
            return(new Bpl.NAryExpr(tok, new Bpl.FunctionCall(new Bpl.IdentifierExpr(tok, name, Bpl.Type.Int)), new List <Bpl.Expr> {
                arr
            }));
        }