diff options
author | Ignacio Etcheverry <neikeq@users.noreply.github.com> | 2018-12-08 22:08:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-08 22:08:18 +0100 |
commit | c9550b800aed10451273143958dfff461105d45b (patch) | |
tree | 18a32ab01c83814c10612b35d9217cf68c405d74 /modules/mono/mono_gd/gd_mono_method.cpp | |
parent | 41d1dba35fc851258d5aabad819d09f6a43e324c (diff) | |
parent | b26487a2b46e6a15af2cbbed88755fd33d35e935 (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.cpp | 27 |
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; |