From 98567e20f31f4d095320269dc166c904cd3ad67a Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Thu, 16 Aug 2012 15:31:46 +0200 Subject: [PATCH] print a proper error message when a function lacks a body --- ast.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ast.c b/ast.c index 41a53f0..d8bd293 100644 --- a/ast.c +++ b/ast.c @@ -846,6 +846,11 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir) return true; } + if (!self->blocks_count) { + asterror(ast_ctx(self), "function `%s` has no body", self->name); + return false; + } + self->curblock = ir_function_create_block(irf, "entry"); if (!self->curblock) return false; @@ -867,6 +872,7 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir) else { /* error("missing return"); */ + asterror(ast_ctx(self), "function `%s` missing return value", self->name); return false; } } -- 2.39.2