summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRaul Santos <raulsntos@gmail.com>2022-02-10 16:01:22 +0100
committerRaul Santos <raulsntos@gmail.com>2022-03-03 18:53:15 +0100
commit424817039aca0c70f94727ad7069bec1023fb78e (patch)
tree9181df34f76259b9a3cfafa8112cb99fdf56c7f9 /modules
parent47a7d85cc42a871106d57f45af744ea85d19be47 (diff)
Check for missing methods/members in C# documentation generator
- Outputs errors for missing members or methods when generating the C# documentation. - Hardcodes a special case for the `_init` method, in C# we'll reference the constructor. - Ignores properties with slashes (since they are not declared in C# and can't be referenced in the documentation).
Diffstat (limited to 'modules')
-rw-r--r--modules/mono/editor/bindings_generator.cpp38
1 files changed, 32 insertions, 6 deletions
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index c4f6165ccd..4a2f2be3ba 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -325,18 +325,38 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
xml_output.append(link_target);
xml_output.append("</c>");
} else {
- const MethodInterface *target_imethod = target_itype->find_method_by_name(target_cname);
-
- if (target_imethod) {
+ if (target_cname == "_init") {
+ // The _init method is not declared in C#, reference the constructor instead
xml_output.append("<see cref=\"" BINDINGS_NAMESPACE ".");
xml_output.append(target_itype->proxy_name);
xml_output.append(".");
- xml_output.append(target_imethod->proxy_name);
- xml_output.append("\"/>");
+ xml_output.append(target_itype->proxy_name);
+ xml_output.append("()\"/>");
+ } else {
+ const MethodInterface *target_imethod = target_itype->find_method_by_name(target_cname);
+
+ if (target_imethod) {
+ xml_output.append("<see cref=\"" BINDINGS_NAMESPACE ".");
+ xml_output.append(target_itype->proxy_name);
+ xml_output.append(".");
+ xml_output.append(target_imethod->proxy_name);
+ xml_output.append("\"/>");
+ } else {
+ ERR_PRINT("Cannot resolve method reference in documentation: '" + link_target + "'.");
+
+ xml_output.append("<c>");
+ xml_output.append(link_target);
+ xml_output.append("</c>");
+ }
}
}
} else if (link_tag == "member") {
- if (!target_itype || !target_itype->is_object_type) {
+ if (link_target.find("/") >= 0) {
+ // Properties with '/' (slash) in the name are not declared in C#, so there is nothing to reference.
+ xml_output.append("<c>");
+ xml_output.append(link_target);
+ xml_output.append("</c>");
+ } else if (!target_itype || !target_itype->is_object_type) {
if (OS::get_singleton()->is_stdout_verbose()) {
if (target_itype) {
OS::get_singleton()->print("Cannot resolve member reference for non-Godot.Object type in documentation: %s\n", link_target.utf8().get_data());
@@ -358,6 +378,12 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
xml_output.append(".");
xml_output.append(target_iprop->proxy_name);
xml_output.append("\"/>");
+ } else {
+ ERR_PRINT("Cannot resolve member reference in documentation: '" + link_target + "'.");
+
+ xml_output.append("<c>");
+ xml_output.append(link_target);
+ xml_output.append("</c>");
}
}
} else if (link_tag == "signal") {