diff options
author | Yuri Sizov <yuris@humnom.net> | 2023-10-02 20:11:43 +0200 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-10-03 15:48:31 +0200 |
commit | cc0eebd9d8a42f3e57d4633c4388faa6d369d2c8 (patch) | |
tree | e539714cf844f473b5417ee388f9eeab113a863c /modules | |
parent | a2f90d565ad29edcb3bdab77bc7df51cdde8514a (diff) | |
download | redot-engine-cc0eebd9d8a42f3e57d4633c4388faa6d369d2c8.tar.gz |
Validate `code` tags for class and member references
This commit also adds means to manually disable warnings
in `code` tags where it's a false positive with the new
`skip-lint` attribute.
Warnings are now enabled on CI to prevent future errors.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/doc_classes/@GDScript.xml | 6 | ||||
-rw-r--r-- | modules/mono/editor/bindings_generator.cpp | 20 |
2 files changed, 16 insertions, 10 deletions
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index 806ab1e3df..4fec745999 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -601,8 +601,8 @@ @icon("res://path/to/class/icon.svg") [/codeblock] [b]Note:[/b] Only the script can have a custom icon. Inner classes are not supported. - [b]Note:[/b] As annotations describe their subject, the [code]@icon[/code] annotation must be placed before the class definition and inheritance. - [b]Note:[/b] Unlike other annotations, the argument of the [code]@icon[/code] annotation must be a string literal (constant expressions are not supported). + [b]Note:[/b] As annotations describe their subject, the [annotation @icon] annotation must be placed before the class definition and inheritance. + [b]Note:[/b] Unlike other annotations, the argument of the [annotation @icon] annotation must be a string literal (constant expressions are not supported). </description> </annotation> <annotation name="@onready"> @@ -653,7 +653,7 @@ @tool extends Node [/codeblock] - [b]Note:[/b] As annotations describe their subject, the [code]@tool[/code] annotation must be placed before the class definition and inheritance. + [b]Note:[/b] As annotations describe their subject, the [annotation @tool] annotation must be placed before the class definition and inheritance. </description> </annotation> <annotation name="@warning_ignore" qualifiers="vararg"> diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index ccfcf2a87c..36fdda4625 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -264,7 +264,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf } else if (code_tag) { xml_output.append("["); pos = brk_pos + 1; - } else if (tag.begins_with("method ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ") || tag.begins_with("theme_item ") || tag.begins_with("param ")) { + } else if (tag.begins_with("method ") || tag.begins_with("constructor ") || tag.begins_with("operator ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ") || tag.begins_with("theme_item ") || tag.begins_with("param ")) { const int tag_end = tag.find(" "); const String link_tag = tag.substr(0, tag_end); const String link_target = tag.substr(tag_end + 1, tag.length()).lstrip(" "); @@ -298,6 +298,12 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf if (link_tag == "method") { _append_xml_method(xml_output, target_itype, target_cname, link_target, link_target_parts); + } else if (link_tag == "constructor") { + // TODO: Support constructors? + _append_xml_undeclared(xml_output, link_target); + } else if (link_tag == "operator") { + // TODO: Support operators? + _append_xml_undeclared(xml_output, link_target); } else if (link_tag == "member") { _append_xml_member(xml_output, target_itype, target_cname, link_target, link_target_parts); } else if (link_tag == "signal") { @@ -401,29 +407,29 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf pos = brk_end + 1; tag_stack.push_front(tag); - } else if (tag == "code") { + } else if (tag == "code" || tag.begins_with("code ")) { xml_output.append("<c>"); code_tag = true; pos = brk_end + 1; - tag_stack.push_front(tag); - } else if (tag == "codeblock") { + tag_stack.push_front("code"); + } else if (tag == "codeblock" || tag.begins_with("codeblock ")) { xml_output.append("<code>"); code_tag = true; pos = brk_end + 1; - tag_stack.push_front(tag); + tag_stack.push_front("codeblock"); } else if (tag == "codeblocks") { line_del = true; pos = brk_end + 1; tag_stack.push_front(tag); - } else if (tag == "csharp") { + } else if (tag == "csharp" || tag.begins_with("csharp ")) { xml_output.append("<code>"); line_del = false; code_tag = true; pos = brk_end + 1; - tag_stack.push_front(tag); + tag_stack.push_front("csharp"); } else if (tag == "kbd") { // keyboard combinations are not supported in xml comments pos = brk_end + 1; |