You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Allow void as return type for constructors
This commit is contained in:
@@ -1035,7 +1035,10 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode *
|
|||||||
return_type.is_meta_type = false;
|
return_type.is_meta_type = false;
|
||||||
p_function->set_datatype(return_type);
|
p_function->set_datatype(return_type);
|
||||||
if (p_function->return_type) {
|
if (p_function->return_type) {
|
||||||
push_error("Constructor cannot have an explicit return type.", p_function->return_type);
|
GDScriptParser::DataType declared_return = resolve_datatype(p_function->return_type);
|
||||||
|
if (declared_return.kind != GDScriptParser::DataType::BUILTIN || declared_return.builtin_type != Variant::NIL) {
|
||||||
|
push_error("Constructor cannot have an explicit return type.", p_function->return_type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GDScriptParser::DataType return_type = resolve_datatype(p_function->return_type);
|
GDScriptParser::DataType return_type = resolve_datatype(p_function->return_type);
|
||||||
|
|||||||
Reference in New Issue
Block a user