소스 검색

Merge pull request #86972 from zaevi/fix_csharp_method_return_type

C#: Fix return type hint for methods.
Rémi Verschelde 1 년 전
부모
커밋
cea56336b2
2개의 변경된 파일15개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      modules/mono/csharp_script.cpp
  2. 13 0
      modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs

+ 2 - 0
modules/mono/csharp_script.cpp

@@ -2365,6 +2365,8 @@ void CSharpScript::update_script_class_info(Ref<CSharpScript> 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++) {

+ 13 - 0
modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs

@@ -662,6 +662,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)