checkArgumentCount static method
Checks the number of arguments passed to a XPath function.
Implementation
static void checkArgumentCount(
String name, List<XPathExpression> arguments, int min,
[int? max]) {
final count = arguments.length;
if (min <= count && count <= (max ?? min)) return;
final buffer = StringBuffer('Function "$name" expects ');
if (min == max || max == null) {
buffer.write('$min arguments');
} else if (max == unbounded) {
buffer.write('at least $min arguments');
} else {
buffer.write('between $min and $max arguments');
}
buffer.write(', but got $count');
throw XPathEvaluationException(buffer.toString());
}