summaryrefslogtreecommitdiffstats
path: root/core/variant/callable.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2023-01-06 15:37:53 +0100
committerJuan Linietsky <reduzio@gmail.com>2023-01-08 23:35:11 +0100
commit0e0ca01bce1adecde1de745d2b31d2ad0c12bf6b (patch)
treeaea57faa3c7e1a1f7cc2816fba45c4a688422623 /core/variant/callable.cpp
parentb14f7aa9f92ff44135c283a9c88dab5ef9136d64 (diff)
downloadredot-engine-0e0ca01bce1adecde1de745d2b31d2ad0c12bf6b.tar.gz
Properly report Callable bound arguments
Fixes #63213 Adds a function: Callable::get_amount_of_arguments_bound() to query this in callables. Exposed to the engine API.
Diffstat (limited to 'core/variant/callable.cpp')
-rw-r--r--core/variant/callable.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/variant/callable.cpp b/core/variant/callable.cpp
index ba3fc536d7..849bfaa38f 100644
--- a/core/variant/callable.cpp
+++ b/core/variant/callable.cpp
@@ -137,6 +137,14 @@ StringName Callable::get_method() const {
return method;
}
+int Callable::get_bound_arguments_count() const {
+ if (!is_null() && is_custom()) {
+ return custom->get_bound_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()));
@@ -344,6 +352,10 @@ const Callable *CallableCustom::get_base_comparator() const {
return nullptr;
}
+int CallableCustom::get_bound_arguments_count() const {
+ return 0;
+}
+
CallableCustom::CallableCustom() {
ref_count.init();
}