From 0b734a6371a3317415e0aabb40fe55204499dd0a Mon Sep 17 00:00:00 2001 From: Zae Date: Tue, 9 Jan 2024 04:28:17 +0800 Subject: [PATCH] C#: Fix return type hint for methods. (cherry picked from commit 51c54b03d1aac56c2e55a1b7358140bd6cd00de4) --- modules/mono/csharp_script.cpp | 2 ++ .../GodotSharp/Core/Bridge/ScriptManagerBridge.cs | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index d221b33827a..b7a179e377c 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -2346,6 +2346,8 @@ void CSharpScript::update_script_class_info(Ref p_script) { MethodInfo mi; mi.name = name; + mi.return_val = PropertyInfo::from_dict(method_info_dict["return_val"]); + Array params = method_info_dict["params"]; for (int j = 0; j < params.size(); j++) { diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs index cad8688399c..fe552b1ffb9 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs @@ -661,6 +661,19 @@ namespace Godot.Bridge methodInfo.Add("name", method.Name); + var returnVal = new Collections.Dictionary() + { + { "name", method.ReturnVal.Name }, + { "type", (int)method.ReturnVal.Type }, + { "usage", (int)method.ReturnVal.Usage } + }; + if (method.ReturnVal.ClassName != null) + { + returnVal["class_name"] = method.ReturnVal.ClassName; + } + + methodInfo.Add("return_val", returnVal); + var methodParams = new Collections.Array(); if (method.Arguments != null)