Refactored binding system for core types

Moved to a system using variadic templates, shared with CallableBind.

New code is cleaner, faster and allows for much better optimization of core
type functions from GDScript and GDNative.

Added Variant::InternalMethod function for direct call access.
This commit is contained in:
reduz 2020-10-13 15:59:37 -03:00 committed by Juan Linietsky
parent bc91e088e4
commit b8c64184c6
15 changed files with 2229 additions and 1611 deletions

View file

@ -330,9 +330,8 @@ struct _ArrayVariantSort {
}
};
Array &Array::sort() {
void Array::sort() {
_p->array.sort_custom<_ArrayVariantSort>();
return *this;
}
struct _ArrayVariantSortCustom {
@ -349,14 +348,13 @@ struct _ArrayVariantSortCustom {
return res;
}
};
Array &Array::sort_custom(Object *p_obj, const StringName &p_function) {
ERR_FAIL_NULL_V(p_obj, *this);
void Array::sort_custom(Object *p_obj, const StringName &p_function) {
ERR_FAIL_NULL(p_obj);
SortArray<Variant, _ArrayVariantSortCustom, true> avs;
avs.compare.obj = p_obj;
avs.compare.func = p_function;
avs.sort(_p->array.ptrw(), _p->array.size());
return *this;
}
void Array::shuffle() {
@ -415,9 +413,8 @@ int Array::bsearch_custom(const Variant &p_value, Object *p_obj, const StringNam
return bisect(_p->array, p_value, p_before, less);
}
Array &Array::invert() {
void Array::invert() {
_p->array.invert();
return *this;
}
void Array::push_front(const Variant &p_value) {