ast_delete(exp);
return false;
}
-
- *out = (ast_expression*)ret;
- } else if (!parser_next(parser)) {
- parseerror(parser, "expected semicolon");
+ } else {
+ if (!parser_next(parser))
+ parseerror(parser, "parse error");
if (expected->expression.next->expression.vtype != TYPE_VOID) {
parseerror(parser, "return without value");
}
- *out = NULL;
+ ret = ast_return_new(exp->expression.node.context, NULL);
}
+ *out = (ast_expression*)ret;
return true;
}
else if (!strcmp(parser_tokval(parser), "if"))
break;
if (!parser_parse_statement(parser, block, &expr)) {
+ parseerror(parser, "parse error");
ast_block_delete(block);
block = NULL;
goto cleanup;