diff options
Diffstat (limited to 'core/object')
-rw-r--r-- | core/object/make_virtuals.py | 4 | ||||
-rw-r--r-- | core/object/method_bind.h | 34 | ||||
-rw-r--r-- | core/object/script_language_extension.h | 18 |
3 files changed, 28 insertions, 28 deletions
diff --git a/core/object/make_virtuals.py b/core/object/make_virtuals.py index 61bf6d900a..c92ac0961e 100644 --- a/core/object/make_virtuals.py +++ b/core/object/make_virtuals.py @@ -94,7 +94,7 @@ def generate_version(argcount, const=False, returns=False): argtext += ", " callsiargs = "Variant vargs[" + str(argcount) + "]={" callsiargptrs = "\t\tconst Variant *vargptrs[" + str(argcount) + "]={" - callptrargsptr = "\t\tconst GDNativeTypePtr argptrs[" + str(argcount) + "]={" + callptrargsptr = "\t\tGDNativeConstTypePtr argptrs[" + str(argcount) + "]={" callptrargs = "" for i in range(argcount): if i > 0: @@ -121,7 +121,7 @@ def generate_version(argcount, const=False, returns=False): s = s.replace("$CALLSIARGPASS", "(const Variant **)vargptrs," + str(argcount)) callptrargsptr += "};\\\n" s = s.replace("$CALLPTRARGS", callptrargs + callptrargsptr) - s = s.replace("$CALLPTRARGPASS", "(const GDNativeTypePtr*)argptrs") + s = s.replace("$CALLPTRARGPASS", "reinterpret_cast<GDNativeConstTypePtr*>(argptrs)") else: s = s.replace("$CALLSIARGS", "") s = s.replace("$CALLSIARGPASS", "nullptr, 0") diff --git a/core/object/method_bind.h b/core/object/method_bind.h index 598e8a224d..0f1366aefd 100644 --- a/core/object/method_bind.h +++ b/core/object/method_bind.h @@ -110,8 +110,8 @@ public: _FORCE_INLINE_ int get_argument_count() const { return argument_count; }; - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) = 0; - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) = 0; + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const = 0; + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const = 0; StringName get_name() const; void set_name(const StringName &p_name); @@ -158,7 +158,7 @@ public: } #endif - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { ERR_FAIL(); // Can't call. } @@ -210,7 +210,7 @@ class MethodBindVarArgT : public MethodBindVarArgBase<MethodBindVarArgT<T>, T, v friend class MethodBindVarArgBase<MethodBindVarArgT<T>, T, void, false>; public: - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { (static_cast<T *>(p_object)->*MethodBindVarArgBase<MethodBindVarArgT<T>, T, void, false>::method)(p_args, p_arg_count, r_error); return {}; } @@ -246,7 +246,7 @@ public: #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { return (static_cast<T *>(p_object)->*MethodBindVarArgBase<MethodBindVarArgTR<T, R>, T, R, true>::method)(p_args, p_arg_count, r_error); } #if defined(SANITIZERS_ENABLED) && defined(__GNUC__) && !defined(__clang__) @@ -313,7 +313,7 @@ public: } #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { #ifdef TYPED_METHOD_BIND call_with_variant_args_dv(static_cast<T *>(p_object), method, p_args, p_arg_count, r_error, get_default_arguments()); #else @@ -322,7 +322,7 @@ public: return Variant(); } - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { #ifdef TYPED_METHOD_BIND call_with_ptr_args<T, P...>(static_cast<T *>(p_object), method, p_args); #else @@ -380,7 +380,7 @@ public: } #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { #ifdef TYPED_METHOD_BIND call_with_variant_argsc_dv(static_cast<T *>(p_object), method, p_args, p_arg_count, r_error, get_default_arguments()); #else @@ -389,7 +389,7 @@ public: return Variant(); } - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { #ifdef TYPED_METHOD_BIND call_with_ptr_argsc<T, P...>(static_cast<T *>(p_object), method, p_args); #else @@ -457,7 +457,7 @@ public: } #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { Variant ret; #ifdef TYPED_METHOD_BIND call_with_variant_args_ret_dv(static_cast<T *>(p_object), method, p_args, p_arg_count, ret, r_error, get_default_arguments()); @@ -467,7 +467,7 @@ public: return ret; } - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { #ifdef TYPED_METHOD_BIND call_with_ptr_args_ret<T, R, P...>(static_cast<T *>(p_object), method, p_args, r_ret); #else @@ -536,7 +536,7 @@ public: } #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { Variant ret; #ifdef TYPED_METHOD_BIND call_with_variant_args_retc_dv(static_cast<T *>(p_object), method, p_args, p_arg_count, ret, r_error, get_default_arguments()); @@ -546,7 +546,7 @@ public: return ret; } - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { #ifdef TYPED_METHOD_BIND call_with_ptr_args_retc<T, R, P...>(static_cast<T *>(p_object), method, p_args, r_ret); #else @@ -604,13 +604,13 @@ public: } #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { (void)p_object; // unused call_with_variant_args_static_dv(function, p_args, p_arg_count, r_error, get_default_arguments()); return Variant(); } - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { (void)p_object; (void)r_ret; call_with_ptr_args_static_method(function, p_args); @@ -667,13 +667,13 @@ public: } #endif - virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { + virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) const override { Variant ret; call_with_variant_args_static_ret_dv(function, p_args, p_arg_count, ret, r_error, get_default_arguments()); return ret; } - virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override { + virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) const override { (void)p_object; call_with_ptr_args_static_method_ret(function, p_args, r_ret); } diff --git a/core/object/script_language_extension.h b/core/object/script_language_extension.h index 9a2a176096..5262c41644 100644 --- a/core/object/script_language_extension.h +++ b/core/object/script_language_extension.h @@ -650,13 +650,13 @@ public: virtual bool set(const StringName &p_name, const Variant &p_value) override { if (native_info->set_func) { - return native_info->set_func(instance, (const GDNativeStringNamePtr)&p_name, (const GDNativeVariantPtr)&p_value); + return native_info->set_func(instance, (GDNativeConstStringNamePtr)&p_name, (GDNativeConstVariantPtr)&p_value); } return false; } virtual bool get(const StringName &p_name, Variant &r_ret) const override { if (native_info->get_func) { - return native_info->get_func(instance, (const GDNativeStringNamePtr)&p_name, (GDNativeVariantPtr)&r_ret); + return native_info->get_func(instance, (GDNativeConstStringNamePtr)&p_name, (GDNativeVariantPtr)&r_ret); } return false; } @@ -683,7 +683,7 @@ public: virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const override { if (native_info->get_property_type_func) { GDNativeBool is_valid = 0; - GDNativeVariantType type = native_info->get_property_type_func(instance, (const GDNativeStringNamePtr)&p_name, &is_valid); + GDNativeVariantType type = native_info->get_property_type_func(instance, (GDNativeConstStringNamePtr)&p_name, &is_valid); if (r_is_valid) { *r_is_valid = is_valid != 0; } @@ -694,13 +694,13 @@ public: virtual bool property_can_revert(const StringName &p_name) const override { if (native_info->property_can_revert_func) { - return native_info->property_can_revert_func(instance, (const GDNativeStringNamePtr)&p_name); + return native_info->property_can_revert_func(instance, (GDNativeConstStringNamePtr)&p_name); } return false; } virtual bool property_get_revert(const StringName &p_name, Variant &r_ret) const override { if (native_info->property_get_revert_func) { - return native_info->property_get_revert_func(instance, (const GDNativeStringNamePtr)&p_name, (GDNativeVariantPtr)&r_ret); + return native_info->property_get_revert_func(instance, (GDNativeConstStringNamePtr)&p_name, (GDNativeVariantPtr)&r_ret); } return false; } @@ -711,7 +711,7 @@ public: } return nullptr; } - static void _add_property_with_state(const GDNativeStringNamePtr p_name, const GDNativeVariantPtr p_value, void *p_userdata) { + static void _add_property_with_state(GDNativeConstStringNamePtr p_name, GDNativeConstVariantPtr p_value, void *p_userdata) { List<Pair<StringName, Variant>> *state = (List<Pair<StringName, Variant>> *)p_userdata; state->push_back(Pair<StringName, Variant>(*(const StringName *)p_name, *(const Variant *)p_value)); } @@ -744,7 +744,7 @@ public: Variant ret; if (native_info->call_func) { GDNativeCallError ce; - native_info->call_func(instance, (const GDNativeStringNamePtr)&p_method, (const GDNativeVariantPtr *)p_args, p_argcount, (GDNativeVariantPtr)&ret, &ce); + native_info->call_func(instance, (GDNativeConstStringNamePtr)&p_method, (GDNativeConstVariantPtr *)p_args, p_argcount, (GDNativeVariantPtr)&ret, &ce); r_error.error = Callable::CallError::Error(ce.error); r_error.argument = ce.argument; r_error.expected = ce.expected; @@ -799,7 +799,7 @@ public: virtual void property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid) override { if (native_info->set_fallback_func) { - bool ret = native_info->set_fallback_func(instance, (const GDNativeStringNamePtr)&p_name, (const GDNativeVariantPtr)&p_value); + bool ret = native_info->set_fallback_func(instance, (GDNativeConstStringNamePtr)&p_name, (GDNativeConstVariantPtr)&p_value); if (r_valid) { *r_valid = ret; } @@ -808,7 +808,7 @@ public: virtual Variant property_get_fallback(const StringName &p_name, bool *r_valid) override { Variant ret; if (native_info->get_fallback_func) { - bool valid = native_info->get_fallback_func(instance, (const GDNativeStringNamePtr)&p_name, (GDNativeVariantPtr)&ret); + bool valid = native_info->get_fallback_func(instance, (GDNativeConstStringNamePtr)&p_name, (GDNativeVariantPtr)&ret); if (r_valid) { *r_valid = valid; } |