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/csharp_script.cpp | |
parent | 41d1dba35fc851258d5aabad819d09f6a43e324c (diff) | |
download | redot-engine-f13f2d512f0439a29804182cee756dce62add857.tar.gz |
Implement CSharpScript::get_script_method_list and related functionality.
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r-- | modules/mono/csharp_script.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 3c818898e6..ba31f12d37 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -2474,6 +2474,17 @@ void CSharpScript::set_source_code(const String &p_code) { #endif } +void CSharpScript::get_script_method_list(List<MethodInfo> *p_list) const { + + if (!script_class) + return; + + const Vector<GDMonoMethod *> &methods = script_class->get_all_methods(); + for (int i = 0; i < methods.size(); ++i) { + p_list->push_back(methods[i]->get_method_info()); + } +} + bool CSharpScript::has_method(const StringName &p_method) const { if (!script_class) @@ -2482,6 +2493,25 @@ bool CSharpScript::has_method(const StringName &p_method) const { return script_class->has_fetched_method_unknown_params(p_method); } +MethodInfo CSharpScript::get_method_info(const StringName &p_method) const { + + if (!script_class) + return MethodInfo(); + + GDMonoClass *top = script_class; + + while (top && top != native) { + GDMonoMethod *params = top->get_fetched_method_unknown_params(p_method); + if (params) { + return params->get_method_info(); + } + + top = top->get_parent_class(); + } + + return MethodInfo(); +} + Error CSharpScript::reload(bool p_keep_state) { bool has_instances; |