returns() public abstract method

public abstract returns ( ) : Type
return Type
Esempio n. 1
0
        public Map map(Func f)
        {
            Type r = f.returns();

            if (r == Sys.VoidType)
            {
                r = Sys.ObjType.toNullable();
            }
            Map acc = new Map(m_type.m_k, r);

            if (this.ordered())
            {
                acc.ordered(true);
            }
            if (this.caseInsensitive())
            {
                acc.caseInsensitive(true);
            }
            IDictionaryEnumerator en = m_map.GetEnumerator();

            while (en.MoveNext())
            {
                object key = en.Key;
                object val = en.Value;
                acc.set(key, f.call(val, key));
            }
            return(acc);
        }
Esempio n. 2
0
        /// <summary>
        /// Parameterize the specified method (reuse if generic
        /// parameterization isn't necessary).
        /// </summary>
        internal Method parameterize(Method m)
        {
            // if not generic, short circuit and reuse original
            if (!m.isGenericMethod())
            {
                return(m);
            }

            // new signature
            Func func = m.m_func;
            Type ret;
            List pars = new List(Sys.ParamType, m.m_params.sz());

            // parameterize return type
            if (func.returns().isGenericParameter())
            {
                ret = parameterize(func.returns());
            }
            else
            {
                ret = func.returns();
            }

            // narrow pars (or just reuse if not parameterized)
            for (int i = 0; i < m.m_params.sz(); i++)
            {
                Param p = (Param)m.m_params.get(i);
                if (p.m_type.isGenericParameter())
                {
                    pars.add(new Param(p.m_name, parameterize(p.m_type), p.m_mask));
                }
                else
                {
                    pars.add(p);
                }
            }

            Method pm = new Method(this, m.m_name, m.m_flags, m.m_facets, m.m_lineNum, ret, m.m_inheritedReturns, pars, m);

            pm.m_reflect = m.m_reflect;
            return(pm);
        }
Esempio n. 3
0
        public List map(Func f)
        {
            Type r = f.returns();

            if (r == Sys.VoidType)
            {
                r = Sys.ObjType.toNullable();
            }
            List acc = new List(r, (int)size());

            for (int i = 0; i < m_size; i++)
            {
                acc.add(f.call(m_values[i], i));
            }
            return(acc);
        }
Esempio n. 4
0
        public List map(Func f)
        {
            long start = m_start;
            long end   = m_end;
            Type r     = f.returns();

            if (r == Sys.VoidType)
            {
                r = Sys.ObjType.toNullable();
            }
            List acc = new List(r);

            if (start < end)
            {
                if (m_exclusive)
                {
                    --end;
                }
                for (long i = start; i <= end; ++i)
                {
                    acc.add(f.call(i));
                }
            }
            else
            {
                if (m_exclusive)
                {
                    ++end;
                }
                for (long i = start; i >= end; --i)
                {
                    acc.add(f.call(i));
                }
            }
            return(acc);
        }
Esempio n. 5
0
File: Map.cs Progetto: nomit007/f4
 public Map map(Func f)
 {
     Type r = f.returns();
       if (r == Sys.VoidType) r = Sys.ObjType.toNullable();
       Map acc = new Map(m_type.m_k, r);
       if (this.ordered()) acc.ordered(true);
       if (this.caseInsensitive()) acc.caseInsensitive(true);
       IDictionaryEnumerator en = m_map.GetEnumerator();
       while (en.MoveNext())
       {
     object key = en.Key;
     object val = en.Value;
     acc.set(key, f.call(val, key));
       }
       return acc;
 }
Esempio n. 6
0
File: List.cs Progetto: xored/f4
 public List map(Func f)
 {
     Type r = f.returns();
       if (r == Sys.VoidType) r = Sys.ObjType.toNullable();
       List acc = new List(r, (int)size());
       for (int i=0; i<m_size; i++)
     acc.add(f.call(m_values[i], i));
       return acc;
 }
Esempio n. 7
0
File: Range.cs Progetto: nomit007/f4
 public List map(Func f)
 {
     long start = m_start;
       long end = m_end;
       Type r = f.returns();
       if (r == Sys.VoidType) r = Sys.ObjType.toNullable();
       List acc = new List(r);
       if (start < end)
       {
     if (m_exclusive) --end;
     for (long i=start; i<=end; ++i) acc.add(f.call(i));
       }
       else
       {
     if (m_exclusive) ++end;
     for (long i=start; i>=end; --i) acc.add(f.call(i));
       }
       return acc;
 }