Exemplo n.º 1
0
        public static PValue Run(
            StackContext sctx, IIndirectCall f, PValue left, IEnumerable<PValue> source)
        {
            if (sctx == null)
                throw new ArgumentNullException("sctx");
            if (f == null)
                throw new ArgumentNullException("f");
            if (left == null)
                left = PType.Null.CreatePValue();
            if (source == null)
                source = new PValue[] {};

            foreach (var right in source)
            {
                left = f.IndirectCall(sctx, new[] {left, right});
            }
            return left;
        }
Exemplo n.º 2
0
        public static PValue Run(
            StackContext sctx, IIndirectCall f, PValue right, IEnumerable<PValue> source)
        {
            if (sctx == null)
                throw new ArgumentNullException("sctx");
            if (f == null)
                throw new ArgumentNullException("f");
            if (right == null)
                right = PType.Null.CreatePValue();
            if (source == null)
                source = new PValue[] {};

            var lst = new List<PValue>(source);

            for (var i = lst.Count - 1; i >= 0; i--)
            {
                right = f.IndirectCall(sctx, new[] {lst[i], right});
            }
            return right;
        }
Exemplo n.º 3
0
Arquivo: Map.cs Projeto: SealedSun/prx
        protected static IEnumerable<PValue> CoroutineRun(ContextCarrier sctxCarrier,
            IIndirectCall f, IEnumerable<PValue> source)
        {
            var sctx = sctxCarrier.StackContext;

            foreach (var x in source)
                yield return f != null ? f.IndirectCall(sctx, new[] {x}) : x;
        }