Authorize non-empty returns for void functions
This commit is contained in:
parent
a4072085fa
commit
4fa52ac5bf
@ -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, {});
|
||||
|
Loading…
Reference in New Issue
Block a user