ast_breakcont_codegen: error when a target is missing instead of segfaulting trying to access it anyway

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-11-25 23:51:39 +01:00
parent 0564e701c0
commit bf244fc960

5
ast.c
View file

@ -2531,6 +2531,11 @@ bool ast_breakcont_codegen(ast_breakcont *self, ast_function *func, bool lvalue,
else
target = func->breakblock;
if (!target) {
asterror(ast_ctx(self), "%s is lacking a target block", (self->is_continue ? "continue" : "break"));
return false;
}
if (!ir_block_create_jump(func->curblock, target))
return false;
return true;