Пример #1
0
 public LambdaState(InterpretedScriptCode scriptCode, LambdaExpression lambda, InterpreterState caller)
 {
     Assert.NotNull(scriptCode, lambda);
     ScriptCode = scriptCode;
     Lambda     = lambda;
     Caller     = caller;
 }
Пример #2
0
        private static InterpreterState CreateForLambda(InterpretedScriptCode scriptCode, LambdaExpression lambda,
                                                        InterpreterState lexicalParent, InterpreterState caller, object[] args)
        {
            InterpreterState state = new InterpreterState(lexicalParent, new LambdaState(scriptCode, lambda, caller));

            Debug.Assert(args.Length == lambda.Parameters.Count, "number of parameters should match number of arguments");

            //
            // Populate all parameters ...
            //
            for (int i = 0; i < lambda.Parameters.Count; i++)
            {
                state._vars.Add(lambda.Parameters[i], args[i]);
            }

            return(state);
        }
Пример #3
0
 internal static InterpreterState CreateForTopLambda(InterpretedScriptCode scriptCode, LambdaExpression lambda, InterpreterState caller, params object[] args)
 {
     return(CreateForLambda(scriptCode, lambda, null, caller, args));
 }