diff options
| -rw-r--r-- | src/parser/parser_stmt.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/parser/parser_stmt.c b/src/parser/parser_stmt.c index 21d36eb..6250392 100644 --- a/src/parser/parser_stmt.c +++ b/src/parser/parser_stmt.c @@ -463,7 +463,12 @@ ASTNode *parse_defer(ParserContext *ctx, Lexer *l) else { s = ast_create(NODE_RAW_STMT); - s->raw_stmt.content = consume_and_rewrite(ctx, l); + char *raw_content = consume_and_rewrite(ctx, l); + // consume_and_rewrite strips the semicolon, so we must add it back for proper C generation + char *safe_content = xmalloc(strlen(raw_content) + 2); + sprintf(safe_content, "%s;", raw_content); + free(raw_content); + s->raw_stmt.content = safe_content; } ctx->in_defer_block = prev_in_defer; |
