Actually generate the missing return instruction

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-11-30 12:35:33 +01:00
parent 9841bc2f0d
commit 39b8d8431c

4
ast.c
View file

@ -1446,9 +1446,6 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
/* TODO: check return types */ /* TODO: check return types */
if (!self->curblock->is_return) if (!self->curblock->is_return)
{ {
/*
return ir_block_create_return(self->curblock, NULL);
*/
if (!self->vtype->expression.next || if (!self->vtype->expression.next ||
self->vtype->expression.next->expression.vtype == TYPE_VOID) self->vtype->expression.next->expression.vtype == TYPE_VOID)
{ {
@ -1463,6 +1460,7 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
{ {
return false; return false;
} }
return ir_block_create_return(self->curblock, NULL);
} }
} }
return true; return true;