summaryrefslogtreecommitdiffstats
path: root/modules/mono/mono_gd/gd_mono_class.cpp
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2020-04-23 02:19:32 +0200
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2020-04-23 02:26:43 +0200
commit20b9dbb1d522c0a218b1792e7eb19ca1847f5c5c (patch)
tree5db082435f8d4e9875498d443bb53972cae78590 /modules/mono/mono_gd/gd_mono_class.cpp
parent28f0b15c9d36b43f9f05a5155ed1c27f7377d599 (diff)
downloadredot-engine-20b9dbb1d522c0a218b1792e7eb19ca1847f5c5c.tar.gz
C#: Revert marshalling of IDictionary/IEnumerable implementing types
Added marshalling for `System.Collections.Generic.List<T>` and `System.Collections.Generic.Dictionary<TKey, TValue>`.
Diffstat (limited to 'modules/mono/mono_gd/gd_mono_class.cpp')
-rw-r--r--modules/mono/mono_gd/gd_mono_class.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/modules/mono/mono_gd/gd_mono_class.cpp b/modules/mono/mono_gd/gd_mono_class.cpp
index ede4203e35..2c65f7e3a0 100644
--- a/modules/mono/mono_gd/gd_mono_class.cpp
+++ b/modules/mono/mono_gd/gd_mono_class.cpp
@@ -31,6 +31,7 @@
#include "gd_mono_class.h"
#include <mono/metadata/attrdefs.h>
+#include <mono/metadata/debug-helpers.h>
#include "gd_mono_assembly.h"
#include "gd_mono_cache.h"
@@ -55,7 +56,11 @@ String GDMonoClass::get_full_name() const {
return get_full_name(mono_class);
}
-MonoType *GDMonoClass::get_mono_type() {
+String GDMonoClass::get_type_desc() const {
+ return GDMonoUtils::get_type_desc(get_mono_type());
+}
+
+MonoType *GDMonoClass::get_mono_type() const {
// Careful, you cannot compare two MonoType*.
// There is mono_metadata_type_equal, how is this different from comparing two MonoClass*?
return get_mono_type(mono_class);
@@ -264,6 +269,12 @@ bool GDMonoClass::implements_interface(GDMonoClass *p_interface) {
return mono_class_implements_interface(mono_class, p_interface->get_mono_ptr());
}
+bool GDMonoClass::has_public_parameterless_ctor() {
+
+ GDMonoMethod *ctor = get_method(".ctor", 0);
+ return ctor && ctor->get_visibility() == IMonoClassMember::PUBLIC;
+}
+
GDMonoMethod *GDMonoClass::get_method(const StringName &p_name, int p_params_count) {
MethodKey key = MethodKey(p_name, p_params_count);
@@ -328,6 +339,9 @@ GDMonoMethod *GDMonoClass::get_method_with_desc(const String &p_description, boo
MonoMethod *method = mono_method_desc_search_in_class(desc, mono_class);
mono_method_desc_free(desc);
+ if (!method)
+ return nullptr;
+
ERR_FAIL_COND_V(mono_method_get_class(method) != mono_class, nullptr);
return get_method(method);