From 9ddebc0c22866d6b7a7ff3fa64b67cc86c8664da Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Mon, 27 Jun 2022 13:10:04 -0700 Subject: 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 --- modules/gdscript/gdscript_vm.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modules/gdscript/gdscript_vm.cpp') diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp index 20b8d29ec3..3f25c2fa43 100644 --- a/modules/gdscript/gdscript_vm.cpp +++ b/modules/gdscript/gdscript_vm.cpp @@ -177,6 +177,8 @@ String GDScriptFunction::_get_call_error(const Callable::CallError &p_err, const err_text = "Invalid call. Nonexistent " + p_where + "."; } else if (p_err.error == Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL) { err_text = "Attempt to call " + p_where + " on a null instance."; + } else if (p_err.error == Callable::CallError::CALL_ERROR_METHOD_NOT_CONST) { + err_text = "Attempt to call " + p_where + " on a const instance."; } else { err_text = "Bug, call error: #" + itos(p_err.error); } -- cgit v1.2.3