コード例 #1
0
        private static object DoExecute(InterpreterState state, LambdaExpression lambda)
        {
            object ret = Interpreter.Interpret(state, lambda.Body);

            ControlFlow cf = ret as ControlFlow;

            if (cf != null)
            {
                return(cf.Value);
            }
            else
            {
                return(ret);
            }
        }
コード例 #2
0
ファイル: LambdaInvoker.cs プロジェクト: gaybro8777/ironruby
        /// <summary>
        /// Triggers interpretation of the Lambda
        /// </summary>
        public void Invoke <T>(ref int state, ref T current)
        {
            object      res = Interpreter.ExecuteGenerator(_state, _generator.Body);
            ControlFlow cf  = res as ControlFlow;

            if (cf != null && cf.Kind == ControlFlowKind.Yield && _state.CurrentYield != null)
            {
                current = (T)cf.Value;
                state   = InterpretingGenerator;
                return;
            }

            //current = default(T);
            state = GeneratorRewriter.Finished;
        }