예제 #1
0
파일: Lambda.cs 프로젝트: toddcoder/Orange2
            public override Value Next()
            {
                using var outerPopper = new ObjectRegionPopper(objectRegion, "object-region");
                outerPopper.Push();

                using var innerPopper = new SharedRegionPopper(region, sharedRegion, "lambda-generator");
                innerPopper.Push();

                var next = block.Next();

                more = !next.IsNil;
                return(next);
            }
예제 #2
0
        public Value Next(int index)
        {
            using var popper = new SharedRegionPopper(region, this, "loop-range-next");
            popper.Push();
            if (index == 0)
            {
                region.SetParameter(variable, init.Evaluate());
            }

            if (conditionFunc())
            {
                var result = _yielding.Map(y => y.Evaluate()).DefaultTo(() => region[variable]);
                region[variable] = increment.Evaluate();
                return(result);
            }

            return(NilValue);
        }