summaryrefslogtreecommitdiff
path: root/modules/mono/mono_gd/gd_mono_method.cpp
diff options
context:
space:
mode:
authorIgnacio Etcheverry <neikeq@users.noreply.github.com>2018-12-08 22:08:18 +0100
committerGitHub <noreply@github.com>2018-12-08 22:08:18 +0100
commitc9550b800aed10451273143958dfff461105d45b (patch)
tree18a32ab01c83814c10612b35d9217cf68c405d74 /modules/mono/mono_gd/gd_mono_method.cpp
parent41d1dba35fc851258d5aabad819d09f6a43e324c (diff)
parentb26487a2b46e6a15af2cbbed88755fd33d35e935 (diff)
Merge pull request #23438 from zorbathut/zorbathut/csharpinstance
Implement CSharpScript::get_script_method_list and related functionality.
Diffstat (limited to 'modules/mono/mono_gd/gd_mono_method.cpp')
-rw-r--r--modules/mono/mono_gd/gd_mono_method.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/mono/mono_gd/gd_mono_method.cpp b/modules/mono/mono_gd/gd_mono_method.cpp
index 630bda8b4e..6ef6e97f5a 100644
--- a/modules/mono/mono_gd/gd_mono_method.cpp
+++ b/modules/mono/mono_gd/gd_mono_method.cpp
@@ -68,6 +68,10 @@ void GDMonoMethod::_update_signature(MonoMethodSignature *p_method_sig) {
param_types.push_back(param_type);
}
+
+ // clear the cache
+ method_info_fetched = false;
+ method_info = MethodInfo();
}
bool GDMonoMethod::is_static() {
@@ -246,11 +250,34 @@ void GDMonoMethod::get_parameter_types(Vector<ManagedType> &types) const {
}
}
+const MethodInfo &GDMonoMethod::get_method_info() {
+
+ if (!method_info_fetched) {
+ method_info.name = name;
+ method_info.return_val = PropertyInfo(GDMonoMarshal::managed_to_variant_type(return_type), "");
+
+ Vector<StringName> names;
+ get_parameter_names(names);
+
+ for (int i = 0; i < params_count; ++i) {
+ method_info.arguments.push_back(PropertyInfo(GDMonoMarshal::managed_to_variant_type(param_types[i]), names[i]));
+ }
+
+ // TODO: default arguments
+
+ method_info_fetched = true;
+ }
+
+ return method_info;
+}
+
GDMonoMethod::GDMonoMethod(StringName p_name, MonoMethod *p_method) {
name = p_name;
mono_method = p_method;
+ method_info_fetched = false;
+
attrs_fetched = false;
attributes = NULL;