summaryrefslogtreecommitdiffstats
path: root/core/variant/variant.cpp
diff options
context:
space:
mode:
authorK. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>2022-06-27 13:10:04 -0700
committerK. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>2022-06-27 13:33:06 -0700
commit9ddebc0c22866d6b7a7ff3fa64b67cc86c8664da (patch)
tree3bb41cb3143f197ca53ee93f7375598ef5886ec6 /core/variant/variant.cpp
parentc41e4b10c3317f837d4b3ece2fb725a8067d884b (diff)
downloadredot-engine-9ddebc0c22866d6b7a7ff3fa64b67cc86c8664da.tar.gz
Add a const call mode to Object, Variant and Script.
For this to work safely (user not call queue_free or something in the expression), a const call mode was added to Object and Variant (and optionally Script). This mode ensures only const functions can be called, making it safe to use from the editor. Co-Authored-By: reduz <reduzio@gmail.com>
Diffstat (limited to 'core/variant/variant.cpp')
-rw-r--r--core/variant/variant.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp
index 6007268e21..75aec9a619 100644
--- a/core/variant/variant.cpp
+++ b/core/variant/variant.cpp
@@ -3395,6 +3395,8 @@ String Variant::get_call_error_text(Object *p_base, const StringName &p_method,
err_text = "Method not found.";
} else if (ce.error == Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL) {
err_text = "Instance is null";
+ } else if (ce.error == Callable::CallError::CALL_ERROR_METHOD_NOT_CONST) {
+ err_text = "Method not const in const instance";
} else if (ce.error == Callable::CallError::CALL_OK) {
return "Call OK";
}