protected virtual Expression CreateCtorExpression(ConstructorInfo ctor, ParameterInfo targetParameter, bool explicitCast)//, Expression parameterExpression = null) { Check.NotNull(ctor, nameof(ctor)); var parameters = ctor.GetParameters(); Expression[] arguments = expressionBuilder.CreateArgumentExpressions(parameters, explicitCast, targetParameter).ToArray(); return(Expression.New(ctor, arguments)); }
protected override void BuildActSourceCode(MethodSourceCodeGenerationRequest request) { var method = request.Method; var arguments = expressionBuilder.CreateArgumentExpressions(method.GetParameters(), request.NullArgumentNeedsExplicitCast, request.ParameterDestinedAsNull); var callExpression = method.IsStatic ? Expression.Call(method, arguments) : Expression.Call(InstanceExpression, method, arguments); Append(expressionBuilder.ExpressionToString(callExpression)); AppendLine(";"); }