diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-01-02 18:34:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-02 18:34:38 +0100 |
commit | d84cf797a2036beddf2b44948b99c7aa813fcc30 (patch) | |
tree | 4f526165d0e3123e771d3ae77e421f367474218e /modules | |
parent | 8f68e3d966eb39fd56a7573fdec5845b3132801f (diff) | |
parent | c1ff3ef9e83d5e5d37f84d350a7a0e00927f7e6c (diff) |
Merge pull request #34758 from neikeq/mono-bindings-void-vararg
Mono/C#: Fix bindings generator with void vararg methods
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mono/editor/bindings_generator.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index cb5802181b..9beadb1778 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -1602,7 +1602,7 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf // Apparently the name attribute must not include the @ String param_tag_name = iarg.name.begins_with("@") ? iarg.name.substr(1, iarg.name.length()) : iarg.name; - default_args_doc.append(INDENT2 "/// <param name=\"" + param_tag_name + "\">If the parameter is null, then the default value is " + def_arg + "</param>\n"); + default_args_doc.append(MEMBER_BEGIN "/// <param name=\"" + param_tag_name + "\">If the parameter is null, then the default value is " + def_arg + "</param>"); } else { icall_params += arg_type->cs_in.empty() ? iarg.name : sformat(arg_type->cs_in, iarg.name); } @@ -1621,7 +1621,7 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf String xml_summary = bbcode_to_xml(fix_doc_description(p_imethod.method_doc->description), &p_itype); Vector<String> summary_lines = xml_summary.length() ? xml_summary.split("\n") : Vector<String>(); - if (summary_lines.size() || default_args_doc.get_string_length()) { + if (summary_lines.size()) { p_output.append(MEMBER_BEGIN "/// <summary>\n"); for (int i = 0; i < summary_lines.size(); i++) { @@ -1630,11 +1630,14 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf p_output.append("\n"); } - p_output.append(default_args_doc.as_string()); p_output.append(INDENT2 "/// </summary>"); } } + if (default_args_doc.get_string_length()) { + p_output.append(default_args_doc.as_string()); + } + if (!p_imethod.is_internal) { p_output.append(MEMBER_BEGIN "[GodotMethod(\""); p_output.append(p_imethod.name); @@ -2066,9 +2069,11 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte p_output.append(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ".ptr()" : "NULL"); p_output.append(", total_length, vcall_error);\n"); - // See the comment on the C_LOCAL_VARARG_RET declaration - if (return_type->cname != name_cache.type_Variant) { - p_output.append("\t" C_LOCAL_RET " = " C_LOCAL_VARARG_RET ";\n"); + if (!ret_void) { + // See the comment on the C_LOCAL_VARARG_RET declaration + if (return_type->cname != name_cache.type_Variant) { + p_output.append("\t" C_LOCAL_RET " = " C_LOCAL_VARARG_RET ";\n"); + } } } else { p_output.append("\t" CS_PARAM_METHODBIND "->ptrcall(" CS_PARAM_INSTANCE ", "); |