Exemple #1
0
        public static EXPR Map(this EXPR expr, ExprFactory factory, Func <EXPR, EXPR> f)
        {
            Debug.Assert(f != null);
            Debug.Assert(factory != null);

            if (expr == null)
            {
                return(f(expr));
            }

            EXPR result = null;
            EXPR tail   = null;

            foreach (EXPR item in expr.ToEnumerable())
            {
                EXPR mappedItem = f(item);
                factory.AppendItemToList(mappedItem, ref result, ref tail);
            }
            return(result);
        }
Exemple #2
0
 internal CType chooseArrayIndexType(EXPR args)
 {
     // first, select the allowable types
     for (int ipt = 0; ipt < s_rgptIntOp.Length; ipt++)
     {
         CType type = GetReqPDT(s_rgptIntOp[ipt]);
         foreach (EXPR arg in args.ToEnumerable())
         {
             if (!canConvert(arg, type))
             {
                 goto NEXTI;
             }
         }
         return type;
     NEXTI:
         ;
     }
     return null;
 }