Microsoft.CSharp.RuntimeBinder.RuntimeBinder.GenerateBoundLambda C# (CSharp) Method

GenerateBoundLambda() private method

private GenerateBoundLambda ( ArgumentObject arguments, Scope pScope, EXPR call ) : EXPRBOUNDLAMBDA
arguments ArgumentObject
pScope Microsoft.CSharp.RuntimeBinder.Semantics.Scope
call Microsoft.CSharp.RuntimeBinder.Semantics.EXPR
return Microsoft.CSharp.RuntimeBinder.Semantics.EXPRBOUNDLAMBDA
        private EXPRBOUNDLAMBDA GenerateBoundLambda(
            ArgumentObject[] arguments,
            Scope pScope,
            EXPR call)
        {
            // We don't actually need the real delegate type here - we just need SOME delegate type.
            // This is because we never attempt any conversions on the lambda itself.
            AggregateType delegateType = _symbolTable.GetCTypeFromType(typeof(Func<>)).AsAggregateType();
            LocalVariableSymbol thisLocal = _semanticChecker.GetGlobalSymbolFactory().CreateLocalVar(_semanticChecker.GetNameManager().Add("this"), pScope, _symbolTable.GetCTypeFromType(typeof(object)));
            thisLocal.isThis = true;
            EXPRBOUNDLAMBDA boundLambda = _exprFactory.CreateAnonymousMethod(delegateType);
            EXPRUNBOUNDLAMBDA unboundLambda = _exprFactory.CreateLambda();

            List<Type> paramTypes = new List<Type>();
            foreach (ArgumentObject o in arguments)
            {
                paramTypes.Add(o.Type);
            }
            boundLambda.Initialize(pScope);

            EXPRRETURN returnStatement = _exprFactory.CreateReturn(0, pScope, call);
            EXPRBLOCK block = _exprFactory.CreateBlock(null, returnStatement, pScope);
            boundLambda.OptionalBody = block;
            return boundLambda;
        }