Add methods to get argument count of methods

Added to:
* `Callable`s
* `Object`s
* `ClassDB`
* `Script(Instance)`s
This commit is contained in:
A Thousand Ships
2024-01-28 15:16:09 +01:00
parent 0ace0a1292
commit 59bcc2888c
50 changed files with 821 additions and 3 deletions

View File

@@ -163,6 +163,20 @@ StringName Callable::get_method() const {
return method;
}
int Callable::get_argument_count(bool *r_is_valid) const {
if (is_custom()) {
bool valid = false;
return custom->get_argument_count(r_is_valid ? *r_is_valid : valid);
} else if (!is_null()) {
return get_object()->get_method_argument_count(method, r_is_valid);
} else {
if (r_is_valid) {
*r_is_valid = false;
}
return 0;
}
}
int Callable::get_bound_arguments_count() const {
if (!is_null() && is_custom()) {
return custom->get_bound_arguments_count();
@@ -417,6 +431,11 @@ const Callable *CallableCustom::get_base_comparator() const {
return nullptr;
}
int CallableCustom::get_argument_count(bool &r_is_valid) const {
r_is_valid = false;
return 0;
}
int CallableCustom::get_bound_arguments_count() const {
return 0;
}