Error in the ast already about unreachable statements and don't upset the IR

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-11-19 19:42:25 +01:00
parent ea75003cf4
commit 8ac689c03a

4
ast.c
View file

@ -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;
}