private Maybe<Expression> ExtensionMethod(Expression instance, string methodName, Lazy<Expression[]> args, int errorPos, bool prefixed)
{
MethodBase method;
Expression[] newArguments = prefixed ? args.Value : new[] { instance }.Concat(args.Value).ToArray();
int count = FindBestMethod(_allowedExtensionMethods, methodName, newArguments, out method);
if (count == 1)
{
return Expression.Call((MethodInfo) method, newArguments);
}
if (count > 1)
{
throw new ParseException("There are several methods named {methodName}.".Localize(new { methodName }), errorPos);
}
return Maybe.Nothing;
}