From 4fa52ac5bf68d83c506aaaaa41900e4129ed9f6b Mon Sep 17 00:00:00 2001 From: augustin64 Date: Thu, 4 Jan 2024 22:33:16 +0100 Subject: [PATCH] Authorize non-empty returns for void functions --- src/analysis.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/analysis.cpp b/src/analysis.cpp index c214cc1..6db13d6 100644 --- a/src/analysis.cpp +++ b/src/analysis.cpp @@ -402,11 +402,8 @@ AnalysisResult analyze(Node &ast, Memory &memory) { FunctionPrototype prototype = get(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, {});