Authorize non-empty returns for void functions

This commit is contained in:
augustin64 2024-01-04 22:33:16 +01:00
parent a4072085fa
commit 4fa52ac5bf

View File

@ -402,11 +402,8 @@ AnalysisResult analyze(Node &ast, Memory &memory) {
FunctionPrototype prototype = get<FunctionPrototype>(function.type.data);
Type return_type = get<0>(prototype.at(0));
if (return_type.type == TypeType::Void) {
if (node.children.size() != 0)
throw TypeError(ErrorType::IncompatibleReturnValue, node.pos, {});
if (return_type.type == TypeType::Void)
return {};
}
if (node.children.size() == 0)
throw TypeError(ErrorType::IncompatibleReturnValue, node.pos, {});