From ed0b3c08e15ee6345ece4b135a5e99870a8fc79f Mon Sep 17 00:00:00 2001 From: Danil Alexeev Date: Wed, 4 Oct 2023 07:54:03 +0300 Subject: [PATCH] Core: Fix `Object::has_method()` for script static methods --- core/object/object.cpp | 10 +++++++++- core/object/script_language.h | 3 +++ core/object/script_language_extension.cpp | 1 + core/object/script_language_extension.h | 1 + doc/classes/ScriptExtension.xml | 6 ++++++ modules/gdscript/gdscript.cpp | 4 ++++ modules/gdscript/gdscript.h | 1 + .../runtime/features/static_method_as_callable.gd | 12 ++++++++++++ .../runtime/features/static_method_as_callable.out | 3 +++ 9 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 modules/gdscript/tests/scripts/runtime/features/static_method_as_callable.gd create mode 100644 modules/gdscript/tests/scripts/runtime/features/static_method_as_callable.out diff --git a/core/object/object.cpp b/core/object/object.cpp index f62b93d0ffc..eb645b3a926 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -666,8 +666,16 @@ bool Object::has_method(const StringName &p_method) const { } MethodBind *method = ClassDB::get_method(get_class_name(), p_method); + if (method != nullptr) { + return true; + } - return method != nullptr; + const Script *scr = Object::cast_to