diff options
Diffstat (limited to 'core')
31 files changed, 97 insertions, 329 deletions
diff --git a/core/core_bind.cpp b/core/core_bind.cpp index f3bdea1eec..259d899d39 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -542,9 +542,9 @@ void _OS::dump_memory_to_file(const String &p_file) { struct _OSCoreBindImg { String path; Size2 size; - int fmt; + int fmt = 0; ObjectID id; - int vram; + int vram = 0; bool operator<(const _OSCoreBindImg &p_img) const { return vram == p_img.vram ? id < p_img.id : vram > p_img.vram; } }; diff --git a/core/core_bind.h b/core/core_bind.h index 4a642c47ce..f3a77a4fa6 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -492,8 +492,8 @@ public: virtual ~_Directory(); private: - bool _list_skip_navigational; - bool _list_skip_hidden; + bool _list_skip_navigational = false; + bool _list_skip_hidden = false; }; class _Marshalls : public Object { diff --git a/core/core_constants.cpp b/core/core_constants.cpp index 64bfff1c58..57ea10c074 100644 --- a/core/core_constants.cpp +++ b/core/core_constants.cpp @@ -38,10 +38,10 @@ struct _CoreConstant { #ifdef DEBUG_METHODS_ENABLED StringName enum_name; - bool ignore_value_in_docs; + bool ignore_value_in_docs = false; #endif const char *name; - int value; + int value = 0; _CoreConstant() {} diff --git a/core/crypto/aes_context.cpp b/core/crypto/aes_context.cpp index 8ef1f4f1d4..608f3c912c 100644 --- a/core/crypto/aes_context.cpp +++ b/core/crypto/aes_context.cpp @@ -112,5 +112,4 @@ void AESContext::_bind_methods() { } AESContext::AESContext() { - mode = MODE_MAX; } diff --git a/core/crypto/aes_context.h b/core/crypto/aes_context.h index c23c504a72..557bde1f04 100644 --- a/core/crypto/aes_context.h +++ b/core/crypto/aes_context.h @@ -47,7 +47,7 @@ public: }; private: - Mode mode; + Mode mode = MODE_MAX; CryptoCore::AESContext ctx; PackedByteArray iv; diff --git a/core/crypto/crypto_core.h b/core/crypto/crypto_core.h index 57ba469f8d..c2ec6febe3 100644 --- a/core/crypto/crypto_core.h +++ b/core/crypto/crypto_core.h @@ -37,7 +37,7 @@ class CryptoCore { public: class MD5Context { private: - void *ctx; // To include, or not to include... + void *ctx = nullptr; // To include, or not to include... public: MD5Context(); @@ -50,7 +50,7 @@ public: class SHA1Context { private: - void *ctx; // To include, or not to include... + void *ctx = nullptr; // To include, or not to include... public: SHA1Context(); @@ -63,7 +63,7 @@ public: class SHA256Context { private: - void *ctx; // To include, or not to include... + void *ctx = nullptr; // To include, or not to include... public: SHA256Context(); @@ -76,7 +76,7 @@ public: class AESContext { private: - void *ctx; // To include, or not to include... + void *ctx = nullptr; // To include, or not to include... public: AESContext(); diff --git a/core/crypto/hashing_context.h b/core/crypto/hashing_context.h index 40d075afa9..7cd55ba267 100644 --- a/core/crypto/hashing_context.h +++ b/core/crypto/hashing_context.h @@ -45,7 +45,7 @@ public: private: void *ctx = nullptr; - HashType type; + HashType type = HASH_MD5; protected: static void _bind_methods(); diff --git a/core/debugger/debugger_marshalls.h b/core/debugger/debugger_marshalls.h index f5a1a891bf..0c13790d60 100644 --- a/core/debugger/debugger_marshalls.h +++ b/core/debugger/debugger_marshalls.h @@ -148,7 +148,7 @@ struct DebuggerMarshalls { // Visual Profiler struct VisualProfilerFrame { - uint64_t frame_number; + uint64_t frame_number = 0; Vector<RS::FrameProfileArea> areas; Array serialize(); diff --git a/core/io/file_access_encrypted.h b/core/io/file_access_encrypted.h index fddc6842f3..c760933038 100644 --- a/core/io/file_access_encrypted.h +++ b/core/io/file_access_encrypted.h @@ -47,8 +47,8 @@ private: Vector<uint8_t> key; bool writing = false; FileAccess *file = nullptr; - size_t base; - size_t length; + size_t base = 0; + size_t length = 0; Vector<uint8_t> data; mutable int pos = 0; mutable bool eofed = false; diff --git a/core/io/file_access_memory.h b/core/io/file_access_memory.h index 1a9bd3fbbb..47012b4e83 100644 --- a/core/io/file_access_memory.h +++ b/core/io/file_access_memory.h @@ -35,8 +35,8 @@ class FileAccessMemory : public FileAccess { uint8_t *data = nullptr; - int length; - mutable int pos; + int length = 0; + mutable int pos = 0; static FileAccess *create(); diff --git a/core/io/packed_data_container.h b/core/io/packed_data_container.h index b784abcd16..3899c14bb4 100644 --- a/core/io/packed_data_container.h +++ b/core/io/packed_data_container.h @@ -84,7 +84,7 @@ class PackedDataContainerRef : public Reference { GDCLASS(PackedDataContainerRef, Reference); friend class PackedDataContainer; - uint32_t offset; + uint32_t offset = 0; Ref<PackedDataContainer> from; protected: diff --git a/core/io/pck_packer.h b/core/io/pck_packer.h index c1026c2499..56be1b52df 100644 --- a/core/io/pck_packer.h +++ b/core/io/pck_packer.h @@ -39,7 +39,7 @@ class PCKPacker : public Reference { GDCLASS(PCKPacker, Reference); FileAccess *file = nullptr; - int alignment; + int alignment = 0; uint64_t ofs = 0; Vector<uint8_t> key; @@ -50,9 +50,9 @@ class PCKPacker : public Reference { struct File { String path; String src_path; - uint64_t ofs; - uint64_t size; - bool encrypted; + uint64_t ofs = 0; + uint64_t size = 0; + bool encrypted = false; Vector<uint8_t> md5; }; Vector<File> files; diff --git a/core/math/a_star.h b/core/math/a_star.h index a6fa771b30..7cfa73f2c2 100644 --- a/core/math/a_star.h +++ b/core/math/a_star.h @@ -47,20 +47,20 @@ class AStar : public Reference { struct Point { Point() {} - int id; + int id = 0; Vector3 pos; - real_t weight_scale; - bool enabled; + real_t weight_scale = 0; + bool enabled = false; OAHashMap<int, Point *> neighbours = 4u; OAHashMap<int, Point *> unlinked_neighbours = 4u; // Used for pathfinding. - Point *prev_point; - real_t g_score; - real_t f_score; - uint64_t open_pass; - uint64_t closed_pass; + Point *prev_point = nullptr; + real_t g_score = 0; + real_t f_score = 0; + uint64_t open_pass = 0; + uint64_t closed_pass = 0; }; struct SortPoints { diff --git a/core/math/expression.h b/core/math/expression.h index d9cedb8c2c..6b34bc6ae8 100644 --- a/core/math/expression.h +++ b/core/math/expression.h @@ -133,7 +133,7 @@ private: ENode *next = nullptr; - Type type; + Type type = TYPE_INPUT; ENode() {} virtual ~ENode() { @@ -144,7 +144,7 @@ private: }; struct ExpressionNode { - bool is_op; + bool is_op = false; union { Variant::Operator op; ENode *node; @@ -154,23 +154,23 @@ private: ENode *_parse_expression(); struct InputNode : public ENode { - int index; + int index = 0; InputNode() { type = TYPE_INPUT; } }; struct ConstantNode : public ENode { - Variant value; + Variant value = Variant::NIL; ConstantNode() { type = TYPE_CONSTANT; } }; struct OperatorNode : public ENode { - Variant::Operator op; + Variant::Operator op = Variant::Operator::OP_ADD; - ENode *nodes[2]; + ENode *nodes[2] = { nullptr, nullptr }; OperatorNode() { type = TYPE_OPERATOR; @@ -184,8 +184,8 @@ private: }; struct IndexNode : public ENode { - ENode *base; - ENode *index; + ENode *base = nullptr; + ENode *index = nullptr; IndexNode() { type = TYPE_INDEX; @@ -193,7 +193,7 @@ private: }; struct NamedIndexNode : public ENode { - ENode *base; + ENode *base = nullptr; StringName name; NamedIndexNode() { @@ -202,7 +202,7 @@ private: }; struct ConstructorNode : public ENode { - Variant::Type data_type; + Variant::Type data_type = Variant::Type::NIL; Vector<ENode *> arguments; ConstructorNode() { @@ -211,7 +211,7 @@ private: }; struct CallNode : public ENode { - ENode *base; + ENode *base = nullptr; StringName method; Vector<ENode *> arguments; diff --git a/core/math/quick_hull.h b/core/math/quick_hull.h index 80f32e191b..024325c4fc 100644 --- a/core/math/quick_hull.h +++ b/core/math/quick_hull.h @@ -41,7 +41,7 @@ public: struct Edge { union { uint32_t vertices[2]; - uint64_t id; + uint64_t id = 0; }; bool operator<(const Edge &p_edge) const { @@ -60,7 +60,7 @@ public: struct Face { Plane plane; - uint32_t vertices[3]; + uint32_t vertices[3] = { 0 }; Vector<int> points_over; bool operator<(const Face &p_face) const { @@ -70,11 +70,13 @@ public: private: struct FaceConnect { - List<Face>::Element *left, *right = nullptr; + List<Face>::Element *left = nullptr; + List<Face>::Element *right = nullptr; FaceConnect() {} }; struct RetFaceConnect { - List<Geometry3D::MeshData::Face>::Element *left, *right = nullptr; + List<Geometry3D::MeshData::Face>::Element *left = nullptr; + List<Geometry3D::MeshData::Face>::Element *right = nullptr; RetFaceConnect() {} }; diff --git a/core/object/method_bind.h b/core/object/method_bind.h index ddd6ab6baa..bd308c9630 100644 --- a/core/object/method_bind.h +++ b/core/object/method_bind.h @@ -123,10 +123,7 @@ 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; - -#ifdef PTRCALL_ENABLED virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) = 0; -#endif StringName get_name() const; void set_name(const StringName &p_name); @@ -205,11 +202,9 @@ public: #endif } -#ifdef PTRCALL_ENABLED virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) { - ERR_FAIL(); //can't call - } //todo -#endif + ERR_FAIL(); // Can't call. + } void set_method(NativeCall p_method) { call_method = p_method; } virtual bool is_const() const { return false; } @@ -289,7 +284,6 @@ public: return Variant(); } -#ifdef PTRCALL_ENABLED virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) { #ifdef TYPED_METHOD_BIND call_with_ptr_args<T, P...>(static_cast<T *>(p_object), method, p_args); @@ -297,7 +291,6 @@ public: call_with_ptr_args<MB_T, P...>((MB_T *)(p_object), method, p_args); #endif } -#endif MethodBindT(void (MB_T::*p_method)(P...)) { method = p_method; @@ -370,7 +363,6 @@ public: return Variant(); } -#ifdef PTRCALL_ENABLED virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) { #ifdef TYPED_METHOD_BIND call_with_ptr_argsc<T, P...>(static_cast<T *>(p_object), method, p_args); @@ -378,7 +370,6 @@ public: call_with_ptr_argsc<MB_T, P...>((MB_T *)(p_object), method, p_args); #endif } -#endif MethodBindTC(void (MB_T::*p_method)(P...) const) { method = p_method; @@ -462,7 +453,6 @@ public: return ret; } -#ifdef PTRCALL_ENABLED virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) { #ifdef TYPED_METHOD_BIND call_with_ptr_args_ret<T, R, P...>(static_cast<T *>(p_object), method, p_args, r_ret); @@ -470,7 +460,6 @@ public: call_with_ptr_args_ret<MB_T, R, P...>((MB_T *)(p_object), method, p_args, r_ret); #endif } -#endif MethodBindTR(R (MB_T::*p_method)(P...)) { method = p_method; @@ -555,7 +544,6 @@ public: return ret; } -#ifdef PTRCALL_ENABLED virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) { #ifdef TYPED_METHOD_BIND call_with_ptr_args_retc<T, R, P...>(static_cast<T *>(p_object), method, p_args, r_ret); @@ -563,7 +551,6 @@ public: call_with_ptr_args_retc<MB_T, R, P...>((MB_T *)(p_object), method, p_args, r_ret); #endif } -#endif MethodBindTRC(R (MB_T::*p_method)(P...) const) { method = p_method; diff --git a/core/object/reference.h b/core/object/reference.h index 575f1cd914..0eb127f362 100644 --- a/core/object/reference.h +++ b/core/object/reference.h @@ -252,8 +252,6 @@ public: WeakRef() {} }; -#ifdef PTRCALL_ENABLED - template <class T> struct PtrToArg<Ref<T>> { _FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) { @@ -272,8 +270,6 @@ struct PtrToArg<const Ref<T> &> { } }; -#endif // PTRCALL_ENABLED - #ifdef DEBUG_METHODS_ENABLED template <class T> diff --git a/core/os/dir_access.h b/core/os/dir_access.h index 0f4fa9b250..17f84d3c52 100644 --- a/core/os/dir_access.h +++ b/core/os/dir_access.h @@ -57,7 +57,6 @@ protected: String _get_root_string() const; String fix_path(String p_path) const; - bool next_is_dir; template <class T> static DirAccess *_create_builtin() { diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index fd3c6f8806..b962f61e1f 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -254,8 +254,8 @@ class CharBuffer { Vector<char> vector; char stack_buffer[256]; - char *buffer; - int capacity; + char *buffer = nullptr; + int capacity = 0; int written = 0; bool grow() { diff --git a/core/templates/hash_map.h b/core/templates/hash_map.h index f6b889015a..e1ba381595 100644 --- a/core/templates/hash_map.h +++ b/core/templates/hash_map.h @@ -73,7 +73,7 @@ public: private: friend class HashMap; - uint32_t hash; + uint32_t hash = 0; Element *next = nullptr; Element() {} Pair pair; diff --git a/core/templates/list.h b/core/templates/list.h index d745066e4c..8e14aaa90d 100644 --- a/core/templates/list.h +++ b/core/templates/list.h @@ -137,9 +137,9 @@ public: private: struct _Data { - Element *first; - Element *last; - int size_cache; + Element *first = nullptr; + Element *last = nullptr; + int size_cache = 0; bool erase(const Element *p_I) { ERR_FAIL_COND_V(!p_I, false); diff --git a/core/templates/safe_refcount.h b/core/templates/safe_refcount.h index dc4e62354a..6b08b876f8 100644 --- a/core/templates/safe_refcount.h +++ b/core/templates/safe_refcount.h @@ -165,7 +165,7 @@ uint64_t atomic_exchange_if_greater(volatile uint64_t *pw, volatile uint64_t val #endif struct SafeRefCount { - uint32_t count; + uint32_t count = 0; public: // destroy() is called when weak_count_ drops to zero. diff --git a/core/templates/set.h b/core/templates/set.h index 1bc0a3f41e..d0ac71a710 100644 --- a/core/templates/set.h +++ b/core/templates/set.h @@ -80,7 +80,7 @@ public: private: struct _Data { Element *_root = nullptr; - Element *_nil; + Element *_nil = nullptr; int size_cache = 0; _FORCE_INLINE_ _Data() { diff --git a/core/templates/thread_work_pool.h b/core/templates/thread_work_pool.h index 661060aa3f..e083cdcb24 100644 --- a/core/templates/thread_work_pool.h +++ b/core/templates/thread_work_pool.h @@ -41,8 +41,8 @@ class ThreadWorkPool { std::atomic<uint32_t> index; struct BaseWork { - std::atomic<uint32_t> *index; - uint32_t max_elements; + std::atomic<uint32_t> *index = nullptr; + uint32_t max_elements = 0; virtual void work() = 0; virtual ~BaseWork() = default; }; diff --git a/core/variant/array.cpp b/core/variant/array.cpp index 79bc01b89c..5043868b1d 100644 --- a/core/variant/array.cpp +++ b/core/variant/array.cpp @@ -371,7 +371,7 @@ void Array::sort() { } struct _ArrayVariantSortCustom { - Object *obj; + Object *obj = nullptr; StringName func; _FORCE_INLINE_ bool operator()(const Variant &p_l, const Variant &p_r) const { diff --git a/core/variant/binder_common.h b/core/variant/binder_common.h index 2e38ce5b06..e950709526 100644 --- a/core/variant/binder_common.h +++ b/core/variant/binder_common.h @@ -63,8 +63,6 @@ struct VariantCaster<const T &> { } }; -#ifdef PTRCALL_ENABLED - #define VARIANT_ENUM_CAST(m_enum) \ MAKE_ENUM_TYPE_INFO(m_enum) \ template <> \ @@ -83,19 +81,6 @@ struct VariantCaster<const T &> { } \ }; -#else - -#define VARIANT_ENUM_CAST(m_enum) \ - MAKE_ENUM_TYPE_INFO(m_enum) \ - template <> \ - struct VariantCaster<m_enum> { \ - static _FORCE_INLINE_ m_enum cast(const Variant &p_variant) { \ - return (m_enum)p_variant.operator int(); \ - } \ - }; - -#endif - // Object enum casts must go here VARIANT_ENUM_CAST(Object::ConnectFlags); @@ -118,7 +103,7 @@ struct VariantCaster<char32_t> { return (char32_t)p_variant.operator int(); } }; -#ifdef PTRCALL_ENABLED + template <> struct PtrToArg<char32_t> { _FORCE_INLINE_ static char32_t convert(const void *p_ptr) { @@ -128,7 +113,6 @@ struct PtrToArg<char32_t> { *(int *)p_ptr = p_val; } }; -#endif template <typename T> struct VariantObjectClassChecker { @@ -228,8 +212,6 @@ void call_with_variant_argsc_helper(T *p_instance, void (T::*p_method)(P...) con (void)(p_args); //avoid warning } -#ifdef PTRCALL_ENABLED - template <class T, class... P, size_t... Is> void call_with_ptr_args_helper(T *p_instance, void (T::*p_method)(P...), const void **p_args, IndexSequence<Is...>) { (p_instance->*p_method)(PtrToArg<P>::convert(p_args[Is])...); @@ -255,8 +237,6 @@ void call_with_ptr_args_static_retc_helper(T *p_instance, R (*p_method)(T *, P.. PtrToArg<R>::encode(p_method(p_instance, PtrToArg<P>::convert(p_args[Is])...), r_ret); } -#endif // PTRCALL_ENABLED - template <class T, class... P, size_t... Is> void call_with_validated_variant_args_helper(T *p_instance, void (T::*p_method)(P...), const Variant **p_args, IndexSequence<Is...>) { (p_instance->*p_method)((VariantInternalAccessor<typename GetSimpleTypeT<P>::type_t>::get(p_args[Is]))...); @@ -450,8 +430,6 @@ void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const, call_with_variant_args_retc_helper(p_instance, p_method, args, r_ret, r_error, BuildIndexSequence<sizeof...(P)>{}); } -#ifdef PTRCALL_ENABLED - template <class T, class... P> void call_with_ptr_args(T *p_instance, void (T::*p_method)(P...), const void **p_args) { call_with_ptr_args_helper<T, P...>(p_instance, p_method, p_args, BuildIndexSequence<sizeof...(P)>{}); @@ -477,8 +455,6 @@ void call_with_ptr_args_static_retc(T *p_instance, R (*p_method)(T *, P...), con call_with_ptr_args_static_retc_helper<T, R, P...>(p_instance, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{}); } -#endif // PTRCALL_ENABLED - template <class T, class... P> void call_with_validated_variant_args(Variant *base, void (T::*p_method)(P...), const Variant **p_args) { call_with_validated_variant_args_helper<T, P...>(VariantGetInternalPtr<T>::get_ptr(base), p_method, p_args, BuildIndexSequence<sizeof...(P)>{}); diff --git a/core/variant/callable.h b/core/variant/callable.h index 40621fbde3..9334ae3581 100644 --- a/core/variant/callable.h +++ b/core/variant/callable.h @@ -62,9 +62,9 @@ public: CALL_ERROR_TOO_FEW_ARGUMENTS, // expected is number of arguments CALL_ERROR_INSTANCE_IS_NULL, }; - Error error; - int argument; - int expected; + Error error = Error::CALL_OK; + int argument = 0; + int expected = 0; }; void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, CallError &r_call_error) const; diff --git a/core/variant/method_ptrcall.h b/core/variant/method_ptrcall.h index 936de145f8..40fa3543dc 100644 --- a/core/variant/method_ptrcall.h +++ b/core/variant/method_ptrcall.h @@ -36,11 +36,8 @@ #include "core/typedefs.h" #include "core/variant/variant.h" -#ifdef PTRCALL_ENABLED - template <class T> -struct PtrToArg { -}; +struct PtrToArg {}; #define MAKE_PTRARG(m_type) \ template <> \ @@ -146,7 +143,7 @@ MAKE_PTRARG(PackedVector3Array); MAKE_PTRARG(PackedColorArray); MAKE_PTRARG_BY_REFERENCE(Variant); -//this is for Object +// This is for Object. template <class T> struct PtrToArg<T *> { @@ -170,7 +167,7 @@ struct PtrToArg<const T *> { } }; -//this is for ObjectID +// This is for ObjectID. template <> struct PtrToArg<ObjectID> { @@ -183,7 +180,7 @@ struct PtrToArg<ObjectID> { } }; -//this is for the special cases used by Variant +// This is for the special cases used by Variant. #define MAKE_VECARG(m_type) \ template <> \ @@ -274,18 +271,11 @@ struct PtrToArg<ObjectID> { return ret; \ } \ } -/* -MAKE_VECARG(String); -MAKE_VECARG(uint8_t); -MAKE_VECARG(int); -MAKE_VECARG(float); -MAKE_VECARG(Vector2); -MAKE_VECARG(Vector3); -MAKE_VECARG(Color); -*/ + MAKE_VECARG_ALT(String, StringName); -//for stuff that gets converted to Array vectors +// For stuff that gets converted to Array vectors. + #define MAKE_VECARR(m_type) \ template <> \ struct PtrToArg<Vector<m_type>> { \ @@ -429,6 +419,7 @@ struct PtrToArg<Vector<Face3>> { } } }; + template <> struct PtrToArg<const Vector<Face3> &> { _FORCE_INLINE_ static Vector<Face3> convert(const void *p_ptr) { @@ -450,4 +441,3 @@ struct PtrToArg<const Vector<Face3> &> { }; #endif // METHOD_PTRCALL_H -#endif diff --git a/core/variant/typed_array.h b/core/variant/typed_array.h index ff42cb687e..2f11f22ff8 100644 --- a/core/variant/typed_array.h +++ b/core/variant/typed_array.h @@ -120,8 +120,6 @@ MAKE_TYPED_ARRAY(Vector<Vector2>, Variant::PACKED_VECTOR2_ARRAY) MAKE_TYPED_ARRAY(Vector<Vector3>, Variant::PACKED_VECTOR3_ARRAY) MAKE_TYPED_ARRAY(Vector<Color>, Variant::PACKED_COLOR_ARRAY) -#ifdef PTRCALL_ENABLED - template <class T> struct PtrToArg<TypedArray<T>> { _FORCE_INLINE_ static TypedArray<T> convert(const void *p_ptr) { @@ -140,8 +138,6 @@ struct PtrToArg<const TypedArray<T> &> { } }; -#endif // PTRCALL_ENABLED - #ifdef DEBUG_METHODS_ENABLED template <class T> diff --git a/core/variant/variant.h b/core/variant/variant.h index 093daf0c6f..d87078b5da 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -128,7 +128,7 @@ private: struct ObjData { ObjectID id; - Object *obj; + Object *obj = nullptr; }; /* array helpers */ @@ -370,7 +370,6 @@ public: #ifdef NEED_LONG_INT Variant(signed long p_long); // real one Variant(unsigned long p_long); -//Variant(long unsigned int p_long); #endif Variant(signed short p_short); // real one Variant(unsigned short p_short); @@ -471,10 +470,8 @@ public: static Variant::Type get_operator_return_type(Operator p_operator, Type p_type_a, Type p_type_b); typedef void (*ValidatedOperatorEvaluator)(const Variant *left, const Variant *right, Variant *r_ret); static ValidatedOperatorEvaluator get_validated_operator_evaluator(Operator p_operator, Type p_type_a, Type p_type_b); -#ifdef PTRCALL_ENABLED typedef void (*PTROperatorEvaluator)(const void *left, const void *right, void *r_ret); static PTROperatorEvaluator get_ptr_operator_evaluator(Operator p_operator, Type p_type_a, Type p_type_b); -#endif void zero(); Variant duplicate(bool deep = false) const; diff --git a/core/variant/variant_op.cpp b/core/variant/variant_op.cpp index 74ecbfb8d1..07b024ecb4 100644 --- a/core/variant/variant_op.cpp +++ b/core/variant/variant_op.cpp @@ -47,11 +47,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) + *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<A>::convert(left) + PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -68,11 +66,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) - *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<A>::convert(left) - PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -89,11 +85,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) * *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<A>::convert(left) * PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -110,11 +104,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = VariantGetInternalPtr<A>::get_ptr(left)->xform(*VariantGetInternalPtr<B>::get_ptr(right)); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<A>::convert(left).xform(PtrToArg<B>::convert(right)), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -131,11 +123,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = VariantGetInternalPtr<B>::get_ptr(right)->xform_inv(*VariantGetInternalPtr<A>::get_ptr(left)); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<B>::convert(right).xform_inv(PtrToArg<A>::convert(left)), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -152,11 +142,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) / *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<A>::convert(left) / PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -178,11 +166,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) / *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<A>::convert(left) / PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -199,11 +185,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) % *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<A>::convert(left) % PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -225,11 +209,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) % *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<A>::convert(left) % PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -245,11 +227,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = -*VariantGetInternalPtr<A>::get_ptr(left); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(-PtrToArg<A>::convert(left), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -265,11 +245,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<A>::convert(left), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -286,11 +264,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) << *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<A>::convert(left) << PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -307,11 +283,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) >> *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<A>::convert(left) >> PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -328,11 +302,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) | *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<A>::convert(left) | PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -348,11 +320,9 @@ public: static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) & *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<A>::convert(left) & PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -369,11 +339,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) ^ *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(PtrToArg<A>::convert(left) ^ PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -389,11 +357,9 @@ public: VariantTypeChanger<R>::change(r_ret); *VariantGetInternalPtr<R>::get_ptr(r_ret) = ~*VariantGetInternalPtr<A>::get_ptr(left); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<R>::encode(~PtrToArg<A>::convert(left), r_ret); } -#endif static Variant::Type get_return_type() { return GetTypeInfo<R>::VARIANT_TYPE; } }; @@ -410,14 +376,12 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) == *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<A>::convert(left) == PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; -//equalobject + class OperatorEvaluatorEqualObject { public: static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { @@ -432,11 +396,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = a == b; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) == PtrToArg<Object *>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -452,11 +414,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = a == nullptr; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) == nullptr, r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -472,11 +432,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = nullptr == b; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(nullptr == PtrToArg<Object *>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -493,11 +451,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) != *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<A>::convert(left) != PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -515,11 +471,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = a != b; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) != PtrToArg<Object *>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -535,11 +489,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = a != nullptr; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) != nullptr, r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -555,11 +507,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = nullptr != b; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(nullptr != PtrToArg<Object *>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -576,11 +526,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) < *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<A>::convert(left) < PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -597,11 +545,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) <= *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<A>::convert(left) <= PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -618,11 +564,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) > *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<A>::convert(left) > PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -639,11 +583,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) >= *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<A>::convert(left) >= PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -660,12 +602,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) && *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<A>::convert(left) && PtrToArg<B>::convert(right), r_ret); } -#endif - static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -682,11 +621,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = *VariantGetInternalPtr<A>::get_ptr(left) || *VariantGetInternalPtr<B>::get_ptr(right); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<A>::convert(left) || PtrToArg<B>::convert(right), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -697,7 +634,6 @@ public: _FORCE_INLINE_ static bool xor_op(const A &a, const B &b) { return ((a) || (b)) && !((a) && (b)); } - static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { const A &a = *VariantGetInternalPtr<A>::get_ptr(&p_left); const B &b = *VariantGetInternalPtr<B>::get_ptr(&p_right); @@ -708,12 +644,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = xor_op(*VariantGetInternalPtr<A>::get_ptr(left), *VariantGetInternalPtr<B>::get_ptr(right)); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(xor_op(PtrToArg<A>::convert(left), PtrToArg<B>::convert(right)), r_ret); } -#endif - static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -729,11 +662,9 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = !*VariantGetInternalPtr<A>::get_ptr(left); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(!PtrToArg<A>::convert(left)); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -764,14 +695,11 @@ public: VariantTypeChanger<Array>::change(r_ret); _add_arrays(*VariantGetInternalPtr<Array>::get_ptr(r_ret), *VariantGetInternalPtr<Array>::get_ptr(left), *VariantGetInternalPtr<Array>::get_ptr(right)); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { Array ret; _add_arrays(ret, PtrToArg<Array>::convert(left), PtrToArg<Array>::convert(right)); PtrToArg<Array>::encode(ret, r_ret); } -#endif - static Variant::Type get_return_type() { return Variant::ARRAY; } }; @@ -791,14 +719,11 @@ public: *VariantGetInternalPtr<Vector<T>>::get_ptr(r_ret) = *VariantGetInternalPtr<Vector<T>>::get_ptr(left); VariantGetInternalPtr<Vector<T>>::get_ptr(r_ret)->append_array(*VariantGetInternalPtr<Vector<T>>::get_ptr(right)); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { Vector<T> sum = PtrToArg<Vector<T>>::convert(left); sum.append_array(PtrToArg<Vector<T>>::convert(right)); PtrToArg<Vector<T>>::encode(sum, r_ret); } -#endif - static Variant::Type get_return_type() { return GetTypeInfo<Vector<T>>::VARIANT_TYPE; } }; @@ -819,16 +744,13 @@ public: *r_ret = do_mod(a, &r_valid); r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { VariantTypeChanger<String>::change(r_ret); *VariantGetInternalPtr<String>::get_ptr(r_ret) = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), nullptr); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<String>::encode(do_mod(PtrToArg<String>::convert(left), nullptr), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::STRING; } }; @@ -846,16 +768,13 @@ public: *r_ret = do_mod(a, *VariantGetInternalPtr<Array>::get_ptr(&p_right), &r_valid); r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { VariantTypeChanger<String>::change(r_ret); *VariantGetInternalPtr<String>::get_ptr(r_ret) = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), *VariantGetInternalPtr<Array>::get_ptr(right), nullptr); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<String>::encode(do_mod(PtrToArg<String>::convert(left), PtrToArg<Array>::convert(right), nullptr), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::STRING; } }; @@ -876,16 +795,13 @@ public: *r_ret = do_mod(a, p_right.get_validated_object(), &r_valid); r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { VariantTypeChanger<String>::change(r_ret); *VariantGetInternalPtr<String>::get_ptr(r_ret) = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), right->get_validated_object(), nullptr); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<String>::encode(do_mod(PtrToArg<String>::convert(left), PtrToArg<Object *>::convert(right), nullptr), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::STRING; } }; @@ -906,16 +822,13 @@ public: *r_ret = do_mod(a, *VariantGetInternalPtr<T>::get_ptr(&p_right), &r_valid); r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { VariantTypeChanger<String>::change(r_ret); *VariantGetInternalPtr<String>::get_ptr(r_ret) = do_mod(*VariantGetInternalPtr<String>::get_ptr(left), *VariantGetInternalPtr<T>::get_ptr(right), nullptr); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<String>::encode(do_mod(PtrToArg<String>::convert(left), PtrToArg<T>::convert(right), nullptr), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::STRING; } }; @@ -926,16 +839,13 @@ public: *r_ret = true; r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = true; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(true, r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -946,16 +856,13 @@ public: *r_ret = false; r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = false; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(false, r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -964,9 +871,11 @@ public: _FORCE_INLINE_ static bool _operate_or(bool p_left, bool p_right) { return p_left || p_right; } + _FORCE_INLINE_ static bool _operate_and(bool p_left, bool p_right) { return p_left && p_right; } + _FORCE_INLINE_ static bool _operate_xor(bool p_left, bool p_right) { return (p_left || p_right) && !(p_left && p_right); } @@ -991,29 +900,6 @@ _FORCE_INLINE_ static bool _operate_get_object(const Variant *p_ptr) { return p_ptr->get_validated_object() != nullptr; } -#ifndef PTRCALL_ENABLED - -#define OP_EVALUATOR(m_class_name, m_left, m_right, m_op) \ - class m_class_name { \ - public: \ - static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { \ - *r_ret = m_op(_operate_get_##m_left(&p_left), _operate_get_##m_right(&p_right)); \ - r_valid = true; \ - } \ - \ - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { \ - VariantTypeChanger<bool>::change(r_ret); \ - *VariantGetInternalPtr<bool>::get_ptr(r_ret) = m_op(_operate_get_##m_left(left), _operate_get_##m_right(right)); \ - } \ - \ - static Variant::Type \ - get_return_type() { \ - return Variant::BOOL; \ - } \ - }; - -#else - _FORCE_INLINE_ static bool _operate_get_ptr_nil(const void *p_ptr) { return false; } @@ -1056,11 +942,9 @@ _FORCE_INLINE_ static bool _operate_get_ptr_object(const void *p_ptr) { } \ }; -#endif - // OR -//nil +// nil OP_EVALUATOR(OperatorEvaluatorNilXBoolOr, nil, bool, _operate_or) OP_EVALUATOR(OperatorEvaluatorBoolXNilOr, bool, nil, _operate_or) @@ -1073,7 +957,7 @@ OP_EVALUATOR(OperatorEvaluatorFloatXNilOr, float, nil, _operate_or) OP_EVALUATOR(OperatorEvaluatorObjectXNilOr, object, nil, _operate_or) OP_EVALUATOR(OperatorEvaluatorNilXObjectOr, nil, object, _operate_or) -//bool +// bool OP_EVALUATOR(OperatorEvaluatorBoolXBoolOr, bool, bool, _operate_or) OP_EVALUATOR(OperatorEvaluatorBoolXIntOr, bool, int, _operate_or) @@ -1085,8 +969,7 @@ OP_EVALUATOR(OperatorEvaluatorFloatXBoolOr, float, bool, _operate_or) OP_EVALUATOR(OperatorEvaluatorBoolXObjectOr, bool, object, _operate_or) OP_EVALUATOR(OperatorEvaluatorObjectXBoolOr, object, bool, _operate_or) -//int - +// int OP_EVALUATOR(OperatorEvaluatorIntXIntOr, int, int, _operate_or) OP_EVALUATOR(OperatorEvaluatorIntXFloatOr, int, float, _operate_or) @@ -1095,20 +978,18 @@ OP_EVALUATOR(OperatorEvaluatorFloatXIntOr, float, int, _operate_or) OP_EVALUATOR(OperatorEvaluatorIntXObjectOr, int, object, _operate_or) OP_EVALUATOR(OperatorEvaluatorObjectXIntOr, object, int, _operate_or) -//float - +// float OP_EVALUATOR(OperatorEvaluatorFloatXFloatOr, float, float, _operate_or) OP_EVALUATOR(OperatorEvaluatorFloatXObjectOr, float, object, _operate_or) OP_EVALUATOR(OperatorEvaluatorObjectXFloatOr, object, float, _operate_or) -//object - +// object OP_EVALUATOR(OperatorEvaluatorObjectXObjectOr, object, object, _operate_or) // AND -//nil +// nil OP_EVALUATOR(OperatorEvaluatorNilXBoolAnd, nil, bool, _operate_and) OP_EVALUATOR(OperatorEvaluatorBoolXNilAnd, bool, nil, _operate_and) @@ -1121,7 +1002,7 @@ OP_EVALUATOR(OperatorEvaluatorFloatXNilAnd, float, nil, _operate_and) OP_EVALUATOR(OperatorEvaluatorObjectXNilAnd, object, nil, _operate_and) OP_EVALUATOR(OperatorEvaluatorNilXObjectAnd, nil, object, _operate_and) -//bool +// bool OP_EVALUATOR(OperatorEvaluatorBoolXBoolAnd, bool, bool, _operate_and) OP_EVALUATOR(OperatorEvaluatorBoolXIntAnd, bool, int, _operate_and) @@ -1133,8 +1014,7 @@ OP_EVALUATOR(OperatorEvaluatorFloatXBoolAnd, float, bool, _operate_and) OP_EVALUATOR(OperatorEvaluatorBoolXObjectAnd, bool, object, _operate_and) OP_EVALUATOR(OperatorEvaluatorObjectXBoolAnd, object, bool, _operate_and) -//int - +// int OP_EVALUATOR(OperatorEvaluatorIntXIntAnd, int, int, _operate_and) OP_EVALUATOR(OperatorEvaluatorIntXFloatAnd, int, float, _operate_and) @@ -1143,20 +1023,18 @@ OP_EVALUATOR(OperatorEvaluatorFloatXIntAnd, float, int, _operate_and) OP_EVALUATOR(OperatorEvaluatorIntXObjectAnd, int, object, _operate_and) OP_EVALUATOR(OperatorEvaluatorObjectXIntAnd, object, int, _operate_and) -//float - +// float OP_EVALUATOR(OperatorEvaluatorFloatXFloatAnd, float, float, _operate_and) OP_EVALUATOR(OperatorEvaluatorFloatXObjectAnd, float, object, _operate_and) OP_EVALUATOR(OperatorEvaluatorObjectXFloatAnd, object, float, _operate_and) -//object - +// object OP_EVALUATOR(OperatorEvaluatorObjectXObjectAnd, object, object, _operate_and) // XOR -//nil +// nil OP_EVALUATOR(OperatorEvaluatorNilXBoolXor, nil, bool, _operate_xor) OP_EVALUATOR(OperatorEvaluatorBoolXNilXor, bool, nil, _operate_xor) @@ -1169,7 +1047,7 @@ OP_EVALUATOR(OperatorEvaluatorFloatXNilXor, float, nil, _operate_xor) OP_EVALUATOR(OperatorEvaluatorObjectXNilXor, object, nil, _operate_xor) OP_EVALUATOR(OperatorEvaluatorNilXObjectXor, nil, object, _operate_xor) -//bool +// bool OP_EVALUATOR(OperatorEvaluatorBoolXBoolXor, bool, bool, _operate_xor) OP_EVALUATOR(OperatorEvaluatorBoolXIntXor, bool, int, _operate_xor) @@ -1181,8 +1059,7 @@ OP_EVALUATOR(OperatorEvaluatorFloatXBoolXor, float, bool, _operate_xor) OP_EVALUATOR(OperatorEvaluatorBoolXObjectXor, bool, object, _operate_xor) OP_EVALUATOR(OperatorEvaluatorObjectXBoolXor, object, bool, _operate_xor) -//int - +// int OP_EVALUATOR(OperatorEvaluatorIntXIntXor, int, int, _operate_xor) OP_EVALUATOR(OperatorEvaluatorIntXFloatXor, int, float, _operate_xor) @@ -1191,15 +1068,13 @@ OP_EVALUATOR(OperatorEvaluatorFloatXIntXor, float, int, _operate_xor) OP_EVALUATOR(OperatorEvaluatorIntXObjectXor, int, object, _operate_xor) OP_EVALUATOR(OperatorEvaluatorObjectXIntXor, object, int, _operate_xor) -//float - +// float OP_EVALUATOR(OperatorEvaluatorFloatXFloatXor, float, float, _operate_xor) OP_EVALUATOR(OperatorEvaluatorFloatXObjectXor, float, object, _operate_xor) OP_EVALUATOR(OperatorEvaluatorObjectXFloatXor, object, float, _operate_xor) -//object - +// object OP_EVALUATOR(OperatorEvaluatorObjectXObjectXor, object, object, _operate_xor) class OperatorEvaluatorNotBool { @@ -1208,17 +1083,13 @@ public: *r_ret = !*VariantGetInternalPtr<bool>::get_ptr(&p_left); r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = !*VariantGetInternalPtr<bool>::get_ptr(left); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(!PtrToArg<bool>::convert(left), r_ret); } -#endif - static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -1228,17 +1099,13 @@ public: *r_ret = !*VariantGetInternalPtr<int64_t>::get_ptr(&p_left); r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = !*VariantGetInternalPtr<int64_t>::get_ptr(left); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(!PtrToArg<int64_t>::convert(left), r_ret); } -#endif - static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -1248,17 +1115,13 @@ public: *r_ret = !*VariantGetInternalPtr<double>::get_ptr(&p_left); r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = !*VariantGetInternalPtr<double>::get_ptr(left); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(!PtrToArg<double>::convert(left), r_ret); } -#endif - static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -1268,17 +1131,13 @@ public: *r_ret = p_left.get_validated_object() == nullptr; r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = left->get_validated_object() == nullptr; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<Object *>::convert(left) == nullptr, r_ret); } -#endif - static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -1293,18 +1152,15 @@ public: *r_ret = str_b.find(str_a) != -1; r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { const String &str_a = *VariantGetInternalPtr<String>::get_ptr(left); const String &str_b = *VariantGetInternalPtr<String>::get_ptr(right); VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = str_b.find(str_a) != -1; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<String>::convert(right).find(PtrToArg<String>::convert(left)) != -1, r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -1318,18 +1174,15 @@ public: *r_ret = b.find(a) != -1; r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { const A &a = *VariantGetInternalPtr<A>::get_ptr(left); const B &b = *VariantGetInternalPtr<B>::get_ptr(right); VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = b.find(a) != -1; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<B>::convert(right).find(PtrToArg<A>::convert(left)) != -1, r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -1340,17 +1193,14 @@ public: *r_ret = b.find(Variant()) != -1; r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { const Array &b = *VariantGetInternalPtr<Array>::get_ptr(right); VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = b.find(Variant()) != -1; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<Array>::convert(right).find(Variant()) != -1, r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -1361,17 +1211,14 @@ public: *r_ret = b.find(p_left) != -1; r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { const Array &b = *VariantGetInternalPtr<Array>::get_ptr(right); VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = b.find(*left) != -1; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<Array>::convert(right).find(PtrToArg<Object *>::convert(left)) != -1, r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -1385,18 +1232,15 @@ public: *r_ret = b.has(a); r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { const Dictionary &b = *VariantGetInternalPtr<Dictionary>::get_ptr(right); const A &a = *VariantGetInternalPtr<A>::get_ptr(left); VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = b.has(a); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<Dictionary>::convert(right).has(PtrToArg<A>::convert(left)), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -1408,17 +1252,14 @@ public: *r_ret = b.has(Variant()); r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { const Dictionary &b = *VariantGetInternalPtr<Dictionary>::get_ptr(right); VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = b.has(Variant()); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<Dictionary>::convert(right).has(Variant()), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -1430,17 +1271,14 @@ public: *r_ret = b.has(p_left); r_valid = true; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { const Dictionary &b = *VariantGetInternalPtr<Dictionary>::get_ptr(right); VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = b.has(*left); } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg<bool>::encode(PtrToArg<Dictionary>::convert(right).has(PtrToArg<Object *>::convert(left)), r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -1459,7 +1297,6 @@ public: b->get(a, &r_valid); *r_ret = r_valid; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { Object *l = right->get_validated_object(); ERR_FAIL_COND(l == nullptr); @@ -1470,13 +1307,11 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = valid; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { bool valid; PtrToArg<Object *>::convert(right)->get(PtrToArg<String>::convert(left), &valid); PtrToArg<bool>::encode(valid, r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -1495,7 +1330,6 @@ public: b->get(a, &r_valid); *r_ret = r_valid; } - static void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { Object *l = right->get_validated_object(); ERR_FAIL_COND(l == nullptr); @@ -1506,13 +1340,11 @@ public: VariantTypeChanger<bool>::change(r_ret); *VariantGetInternalPtr<bool>::get_ptr(r_ret) = valid; } -#ifdef PTRCALL_ENABLED static void ptr_evaluate(const void *left, const void *right, void *r_ret) { bool valid; PtrToArg<Object *>::convert(right)->get(PtrToArg<StringName>::convert(left), &valid); PtrToArg<bool>::encode(valid, r_ret); } -#endif static Variant::Type get_return_type() { return Variant::BOOL; } }; @@ -1521,27 +1353,21 @@ typedef void (*VariantEvaluatorFunction)(const Variant &p_left, const Variant &p static Variant::Type operator_return_type_table[Variant::OP_MAX][Variant::VARIANT_MAX][Variant::VARIANT_MAX]; static VariantEvaluatorFunction operator_evaluator_table[Variant::OP_MAX][Variant::VARIANT_MAX][Variant::VARIANT_MAX]; static Variant::ValidatedOperatorEvaluator validated_operator_evaluator_table[Variant::OP_MAX][Variant::VARIANT_MAX][Variant::VARIANT_MAX]; -#ifdef PTRCALL_ENABLED static Variant::PTROperatorEvaluator ptr_operator_evaluator_table[Variant::OP_MAX][Variant::VARIANT_MAX][Variant::VARIANT_MAX]; -#endif template <class T> void register_op(Variant::Operator p_op, Variant::Type p_type_a, Variant::Type p_type_b) { operator_return_type_table[p_op][p_type_a][p_type_b] = T::get_return_type(); operator_evaluator_table[p_op][p_type_a][p_type_b] = T::evaluate; validated_operator_evaluator_table[p_op][p_type_a][p_type_b] = T::validated_evaluate; -#ifdef PTRCALL_ENABLED ptr_operator_evaluator_table[p_op][p_type_a][p_type_b] = T::ptr_evaluate; -#endif } void Variant::_register_variant_operators() { zeromem(operator_return_type_table, sizeof(operator_return_type_table)); zeromem(operator_evaluator_table, sizeof(operator_evaluator_table)); zeromem(validated_operator_evaluator_table, sizeof(validated_operator_evaluator_table)); -#ifdef PTRCALL_ENABLED zeromem(ptr_operator_evaluator_table, sizeof(ptr_operator_evaluator_table)); -#endif register_op<OperatorEvaluatorAdd<int64_t, int64_t, int64_t>>(Variant::OP_ADD, Variant::INT, Variant::INT); register_op<OperatorEvaluatorAdd<double, int64_t, double>>(Variant::OP_ADD, Variant::INT, Variant::FLOAT); @@ -1896,7 +1722,7 @@ void Variant::_register_variant_operators() { register_op<OperatorEvaluatorAlwaysFalse<Variant::OP_OR, Variant::NIL, Variant::NIL>>(Variant::OP_OR, Variant::NIL, Variant::NIL); - //OR + // OR register_op<OperatorEvaluatorNilXBoolOr>(Variant::OP_OR, Variant::NIL, Variant::BOOL); register_op<OperatorEvaluatorBoolXNilOr>(Variant::OP_OR, Variant::BOOL, Variant::NIL); register_op<OperatorEvaluatorNilXIntOr>(Variant::OP_OR, Variant::NIL, Variant::INT); @@ -1924,7 +1750,8 @@ void Variant::_register_variant_operators() { register_op<OperatorEvaluatorFloatXObjectOr>(Variant::OP_OR, Variant::FLOAT, Variant::OBJECT); register_op<OperatorEvaluatorObjectXFloatOr>(Variant::OP_OR, Variant::OBJECT, Variant::FLOAT); register_op<OperatorEvaluatorObjectXObjectOr>(Variant::OP_OR, Variant::OBJECT, Variant::OBJECT); - //AND + + // AND register_op<OperatorEvaluatorNilXBoolAnd>(Variant::OP_AND, Variant::NIL, Variant::BOOL); register_op<OperatorEvaluatorBoolXNilAnd>(Variant::OP_AND, Variant::BOOL, Variant::NIL); register_op<OperatorEvaluatorNilXIntAnd>(Variant::OP_AND, Variant::NIL, Variant::INT); @@ -1952,7 +1779,8 @@ void Variant::_register_variant_operators() { register_op<OperatorEvaluatorFloatXObjectAnd>(Variant::OP_AND, Variant::FLOAT, Variant::OBJECT); register_op<OperatorEvaluatorObjectXFloatAnd>(Variant::OP_AND, Variant::OBJECT, Variant::FLOAT); register_op<OperatorEvaluatorObjectXObjectAnd>(Variant::OP_AND, Variant::OBJECT, Variant::OBJECT); - //XOR + + // XOR register_op<OperatorEvaluatorNilXBoolXor>(Variant::OP_XOR, Variant::NIL, Variant::BOOL); register_op<OperatorEvaluatorBoolXNilXor>(Variant::OP_XOR, Variant::BOOL, Variant::NIL); register_op<OperatorEvaluatorNilXIntXor>(Variant::OP_XOR, Variant::NIL, Variant::INT); @@ -2124,7 +1952,7 @@ Variant::ValidatedOperatorEvaluator Variant::get_validated_operator_evaluator(Op ERR_FAIL_INDEX_V(p_type_b, Variant::VARIANT_MAX, nullptr); return validated_operator_evaluator_table[p_operator][p_type_a][p_type_b]; } -#ifdef PTRCALL_ENABLED + Variant::PTROperatorEvaluator Variant::get_ptr_operator_evaluator(Operator p_operator, Type p_type_a, Type p_type_b) { ERR_FAIL_INDEX_V(p_operator, Variant::OP_MAX, nullptr); ERR_FAIL_INDEX_V(p_type_a, Variant::VARIANT_MAX, nullptr); @@ -2132,8 +1960,6 @@ Variant::PTROperatorEvaluator Variant::get_ptr_operator_evaluator(Operator p_ope return ptr_operator_evaluator_table[p_operator][p_type_a][p_type_b]; } -#endif - static const char *_op_names[Variant::OP_MAX] = { "==", "!=", |