summaryrefslogtreecommitdiffstats
path: root/core/variant/callable.cpp
diff options
context:
space:
mode:
authorDanil Alexeev <dalexeev12@yandex.ru>2024-11-01 02:28:21 +0300
committerDanil Alexeev <dalexeev12@yandex.ru>2024-11-04 22:41:56 +0300
commite379cc76e5e4cdba8393ed5988f12a6c46a77493 (patch)
treef963bebb30ca8160b2c8911c5d3e061bc5430aab /core/variant/callable.cpp
parent1bffd6c73b44b85e5889f54e14b2193940cf5bb1 (diff)
downloadredot-engine-e379cc76e5e4cdba8393ed5988f12a6c46a77493.tar.gz
Core: Fix `Callable.get_bound_arguments{,_count}()` return incorrect data
Diffstat (limited to 'core/variant/callable.cpp')
-rw-r--r--core/variant/callable.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/core/variant/callable.cpp b/core/variant/callable.cpp
index 5ce90cd8ff..ddeea27118 100644
--- a/core/variant/callable.cpp
+++ b/core/variant/callable.cpp
@@ -206,19 +206,17 @@ int Callable::get_bound_arguments_count() const {
}
}
-void Callable::get_bound_arguments_ref(Vector<Variant> &r_arguments, int &r_argcount) const {
+void Callable::get_bound_arguments_ref(Vector<Variant> &r_arguments) const {
if (!is_null() && is_custom()) {
- custom->get_bound_arguments(r_arguments, r_argcount);
+ custom->get_bound_arguments(r_arguments);
} else {
r_arguments.clear();
- r_argcount = 0;
}
}
Array Callable::get_bound_arguments() const {
Vector<Variant> arr;
- int ac;
- get_bound_arguments_ref(arr, ac);
+ get_bound_arguments_ref(arr);
Array ret;
ret.resize(arr.size());
for (int i = 0; i < arr.size(); i++) {
@@ -227,6 +225,14 @@ Array Callable::get_bound_arguments() const {
return ret;
}
+int Callable::get_unbound_arguments_count() const {
+ if (!is_null() && is_custom()) {
+ return custom->get_unbound_arguments_count();
+ } else {
+ return 0;
+ }
+}
+
CallableCustom *Callable::get_custom() const {
ERR_FAIL_COND_V_MSG(!is_custom(), nullptr,
vformat("Can't get custom on non-CallableCustom \"%s\".", operator String()));
@@ -464,9 +470,12 @@ int CallableCustom::get_bound_arguments_count() const {
return 0;
}
-void CallableCustom::get_bound_arguments(Vector<Variant> &r_arguments, int &r_argcount) const {
- r_arguments = Vector<Variant>();
- r_argcount = 0;
+void CallableCustom::get_bound_arguments(Vector<Variant> &r_arguments) const {
+ r_arguments.clear();
+}
+
+int CallableCustom::get_unbound_arguments_count() const {
+ return 0;
}
CallableCustom::CallableCustom() {