示例#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));
 }