public void SetBody(LambdaExpression body, IILGeneratorFactory ilGeneratorFactory, DebugInfoGenerator debugInfoGeneratorOrNull) { ArgumentUtility.CheckNotNull("body", body); ArgumentUtility.CheckNotNull("ilGeneratorFactory", ilGeneratorFactory); _methodBaseBuilder.SetBody(body, ilGeneratorFactory, debugInfoGeneratorOrNull); }
private Action CreateBodyBuildAction( CodeGenerationContext context, IMethodBaseBuilder methodBuilder, IEnumerable <ParameterExpression> parameterExpressions, Expression unpreparedBody) { // Bodies need to be generated after all other members have been declared (to allow bodies to reference new members). return(() => { var body = _expressionPreparer.PrepareBody(context, unpreparedBody); var bodyLambda = Expression.Lambda(body, parameterExpressions); methodBuilder.SetBody(bodyLambda, _ilGeneratorFactory, context.DebugInfoGenerator); }); }