Python: Address review comments

This commit is contained in:
Taus
2025-03-04 22:30:55 +00:00
parent 83cdcdbb0b
commit bf3d9ee6a9
2 changed files with 11 additions and 5 deletions

View File

@@ -165,12 +165,18 @@ class Function extends Function_, Scope, AstNode {
}
/** Gets the minimum number of positional arguments that can be correctly passed to this function. */
int getMinArguments() {
int getMinPositionalArguments() {
result = count(this.getAnArg()) - count(this.getDefinition().getArgs().getADefault())
}
/** Gets the maximum number of positional arguments that can be correctly passed to this function. */
int getMaxArguments() {
/**
* Gets the maximum number of positional arguments that can be correctly passed to this function.
*
* If the function has a `*vararg` parameter, there is no upper limit on the number of positional
* arguments that can be passed to the function. In this case, this method returns a very large
* number (currently `INT_MAX`, 2147483647, but this may change in the future).
*/
int getMaxPositionalArguments() {
if exists(this.getVararg())
then result = 2147483647 // INT_MAX
else result = count(this.getAnArg())