private Delegate EmitMethodEpilogue <T>(ExpressionTreeContext context, Type delegateType, T method, ExpressionConstruct construct) { if (SerializerDebugging.TraceEnabled) { SerializerDebugging.TraceEvent("----{0}----", method); construct.ToString(SerializerDebugging.ILTraceWriter); SerializerDebugging.FlushTraceData(); } var lambda = Expression.Lambda( delegateType, construct.Expression, method.ToString(), false, context.GetCurrentParameters() ); #if !NETFX_CORE && !SILVERLIGHT if (SerializerDebugging.DumpEnabled) { var mb = this._typeBuilder.DefineMethod( method.ToString(), MethodAttributes.Public | MethodAttributes.Static, lambda.Type, lambda.Parameters.Select(e => e.Type).ToArray() ); lambda.CompileToMethod(mb); } #endif return(lambda.Compile()); }
protected override ExpressionConstruct ReferArgument(ExpressionTreeContext context, Type type, string name, int index) { return(context.GetCurrentParameters()[index]); }