diff options
| author | Ben Rog-Wilhelm <zorba-githubdesktop20180420@pavlovian.net> | 2018-11-01 08:35:16 -0700 |
|---|---|---|
| committer | Ben Rog-Wilhelm <zorba-git20110501@pavlovian.net> | 2018-12-07 23:54:40 -0800 |
| commit | f13f2d512f0439a29804182cee756dce62add857 (patch) | |
| tree | 3eeb1fb32881c29ca3c6930c6073ba8ac9f57b8c /modules/mono/mono_gd/gd_mono_method.cpp | |
| parent | 41d1dba35fc851258d5aabad819d09f6a43e324c (diff) | |
| download | redot-engine-f13f2d512f0439a29804182cee756dce62add857.tar.gz | |
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; |
