From 1cc3705da4908a493bea2fbf6d02da1f66b6d9f0 Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Sun, 19 Aug 2012 20:28:14 +0200 Subject: [PATCH] Don't have the ast's codegen error on missing returns --- ast.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ast.c b/ast.c index 7c349b4..67306a1 100644 --- a/ast.c +++ b/ast.c @@ -934,6 +934,9 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir) /* TODO: check return types */ if (!self->curblock->is_return) { + return ir_block_create_return(self->curblock, NULL); + /* From now on the parser has to handle this situation */ +#if 0 if (!self->vtype->expression.next || self->vtype->expression.next->expression.vtype == TYPE_VOID) { @@ -945,6 +948,7 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir) asterror(ast_ctx(self), "function `%s` missing return value", self->name); return false; } +#endif } return true; } -- 2.39.2