From c1ff3ef9e83d5e5d37f84d350a7a0e00927f7e6c Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Thu, 2 Jan 2020 18:09:59 +0100 Subject: Mono/C#: Fix comment generation for non-constant param default - Generate the comment for the param, even if the method has no description. - Generate the comment outside the element. --- modules/mono/editor/bindings_generator.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 0557d44a02..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 "/// If the parameter is null, then the default value is " + def_arg + "\n"); + default_args_doc.append(MEMBER_BEGIN "/// If the parameter is null, then the default value is " + def_arg + ""); } 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 summary_lines = xml_summary.length() ? xml_summary.split("\n") : Vector(); - if (summary_lines.size() || default_args_doc.get_string_length()) { + if (summary_lines.size()) { p_output.append(MEMBER_BEGIN "/// \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 "/// "); } } + 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); -- cgit v1.2.3