From e548d607e047a456c0ea6bcba88d1e70236f207b Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Mon, 27 Jun 2022 13:10:04 -0700 Subject: [PATCH] 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 --- visual_script.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/visual_script.cpp b/visual_script.cpp index c4fafb6..c5bcf23 100644 --- a/visual_script.cpp +++ b/visual_script.cpp @@ -1655,6 +1655,8 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p error_str += "Expected " + itos(r_error.argument) + " arguments."; } else if (r_error.error == Callable::CallError::CALL_ERROR_INVALID_METHOD) { error_str += "Invalid Call."; + } else if (r_error.error == Callable::CallError::CALL_ERROR_METHOD_NOT_CONST) { + error_str += "Method not const in a const instance."; } else if (r_error.error == Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL) { error_str += "Base Instance is null"; }