private static Type[] /*!*/ GetSignatureToMatch(CallArguments /*!*/ args, bool includeSelf, bool selfIsInstance)
{
var result = new List <Type>(args.ExplicitArgumentCount);
// self (instance):
if (includeSelf && selfIsInstance)
{
result.Add(CompilerHelpers.GetType(args.Target));
}
// block:
if (args.Signature.HasBlock)
{
// use None to let binder know that [NotNull]BlockParam is not applicable
result.Add(args.GetBlock() != null ? typeof(BlockParam) : typeof(Null));
}
else
{
result.Add(typeof(MissingBlockParam));
}
// self (non-instance):
if (includeSelf && !selfIsInstance)
{
result.Add(CompilerHelpers.GetType(args.Target));
}
// simple args:
for (int i = 0; i < args.SimpleArgumentCount; i++)
{
result.Add(CompilerHelpers.GetType(args.GetSimpleArgument(i)));
}
// splat arg:
if (args.Signature.HasSplattedArgument)
{
object splattedArg = args.GetSplattedArgument();
var list = splattedArg as List <object>;
if (list != null)
{
foreach (object obj in list)
{
result.Add(CompilerHelpers.GetType(obj));
}
}
else
{
result.Add(CompilerHelpers.GetType(splattedArg));
}
}
// rhs arg:
if (args.Signature.HasRhsArgument)
{
result.Add(CompilerHelpers.GetType(args.GetRhsArgument()));
}
return(result.ToArray());
}