private static ErrorInfo MakeIncorrectArgumentCountError(BindingTarget target)
{
int minArgs = Int32.MaxValue;
int maxArgs = Int32.MinValue;
foreach (int argCnt in target.ExpectedArgumentCount)
{
minArgs = System.Math.Min(minArgs, argCnt);
maxArgs = System.Math.Max(maxArgs, argCnt);
}
return(ErrorInfo.FromException(
Ast.Call(
typeof(BinderOps).GetMethod("TypeErrorForIncorrectArgumentCount", new Type[] {
typeof(string), typeof(int), typeof(int), typeof(int), typeof(int), typeof(bool), typeof(bool)
}),
Ast.Constant(target.Name, typeof(string)), // name
Ast.Constant(minArgs), // min formal normal arg cnt
Ast.Constant(maxArgs), // max formal normal arg cnt
Ast.Constant(0), // default cnt
Ast.Constant(target.ActualArgumentCount), // args provided
Ast.Constant(false), // hasArgList
Ast.Constant(false) // kwargs provided
)
));
}