matches method
Returns whether positional
and names
are valid for this argument
declaration.
Implementation
bool matches(int positional, Set<String> names) {
var namedUsed = 0;
for (var i = 0; i < arguments.length; i++) {
var argument = arguments[i];
if (i < positional) {
if (names.contains(argument.name)) return false;
} else if (names.contains(argument.name)) {
namedUsed++;
} else if (argument.defaultValue == null) {
return false;
}
}
if (restArgument != null) return true;
if (positional > arguments.length) return false;
if (namedUsed < names.length) return false;
return true;
}