GDScript: Fix compiler generates incorrect bytecode for conversion return

This commit is contained in:
Danil Alexeev
2026-02-03 17:32:04 +03:00
parent 734f5473c1
commit d0eb19359e
14 changed files with 164 additions and 129 deletions
+2 -3
View File
@@ -434,10 +434,9 @@ void GDScriptDocGen::_generate_docs(GDScript *p_script, const GDP::ClassNode *p_
method_doc.qualifiers += "static";
}
if (func_name == "_init") {
if (func_name == "_init" || func_name == "_static_init") {
method_doc.return_type = "void";
} else if (m_func->return_type) {
// `m_func->return_type->get_datatype()` is a metatype.
} else if (!m_func->get_datatype().is_variant()) {
_doctype_from_gdtype(m_func->get_datatype(), method_doc.return_type, method_doc.return_enum, true);
} else if (!m_func->body->has_return) {
// If no `return` statement, then return type is `void`, not `Variant`.