]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Error in the ast already about unreachable statements and don't upset the IR
authorWolfgang (Blub) Bumiller <blub@speed.at>
Mon, 19 Nov 2012 18:42:25 +0000 (19:42 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Mon, 19 Nov 2012 18:42:25 +0000 (19:42 +0100)
ast.c

diff --git a/ast.c b/ast.c
index 8de6e85b73e214ba4ecc86e301fb9f024a55ad4f..51912e94ca284356004fb62acfc5f6c115754f8c 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -1361,6 +1361,10 @@ bool ast_block_codegen(ast_block *self, ast_function *func, bool lvalue, ir_valu
     for (i = 0; i < vec_size(self->exprs); ++i)
     {
         ast_expression_codegen *gen = self->exprs[i]->expression.codegen;
+        if (func->curblock->final) {
+            asterror(ast_ctx(self->exprs[i]), "unreachable statement");
+            return false;
+        }
         if (!(*gen)(self->exprs[i], func, false, out))
             return false;
     }