summaryrefslogtreecommitdiff
path: root/core/variant/variant_call.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-06-25 23:29:30 +0200
committerGitHub <noreply@github.com>2021-06-25 23:29:30 +0200
commit56dafe916468f0c18e8ac77516c349e3dd8f93cb (patch)
tree176b9bb1217200cafec3613df6cf8369dcd73dd4 /core/variant/variant_call.cpp
parentc8444c3ee078e33c33287cf879aa5daecb962a80 (diff)
parentb1d15c51bc1ded928b266ffc06459dd8b2046eb4 (diff)
Merge pull request #49744 from reduz/implement-native-extensions
Implement native extension system
Diffstat (limited to 'core/variant/variant_call.cpp')
-rw-r--r--core/variant/variant_call.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp
index 9c7cd23d72..95c4e7121b 100644
--- a/core/variant/variant_call.cpp
+++ b/core/variant/variant_call.cpp
@@ -1126,6 +1126,25 @@ bool Variant::is_builtin_method_vararg(Variant::Type p_type, const StringName &p
return method->is_vararg;
}
+uint32_t Variant::get_builtin_method_hash(Variant::Type p_type, const StringName &p_method) {
+ ERR_FAIL_INDEX_V(p_type, Variant::VARIANT_MAX, 0);
+ const VariantBuiltInMethodInfo *method = builtin_method_info[p_type].lookup_ptr(p_method);
+ ERR_FAIL_COND_V(!method, 0);
+ uint32_t hash = hash_djb2_one_32(method->is_const);
+ hash = hash_djb2_one_32(method->is_static, hash);
+ hash = hash_djb2_one_32(method->is_vararg, hash);
+ hash = hash_djb2_one_32(method->has_return_type, hash);
+ if (method->has_return_type) {
+ hash = hash_djb2_one_32(method->return_type, hash);
+ }
+ hash = hash_djb2_one_32(method->argument_count, hash);
+ for (int i = 0; i < method->argument_count; i++) {
+ hash = method->get_argument_type(i);
+ }
+
+ return hash;
+}
+
void Variant::get_method_list(List<MethodInfo> *p_list) const {
if (type == OBJECT) {
Object *obj = get_validated_object();