diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-08-30 14:36:28 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-08-30 14:36:28 -0400 |
| commit | 1824f840c1564c59eaecfaa25556d4e830d867bc (patch) | |
| tree | 65c63c3d30378a45895c834516e05ac11c945914 | |
| parent | a9df553f3765710c6833fe9705832b1a3bc5b64c (diff) | |
Add 'do' wrapper on blocks
| -rw-r--r-- | src/formatter/formatter.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/formatter/formatter.c b/src/formatter/formatter.c index 88eb210a..266525e8 100644 --- a/src/formatter/formatter.c +++ b/src/formatter/formatter.c @@ -423,7 +423,13 @@ Text_t format_code(ast_t *ast, Table_t comments, Text_t indent) { add_line(&code, Text$trim(comment, Text(" \t\r\n"), false, true), indent); } - add_line(&code, fmt(stmt->ast, comments, indent), indent); + if (stmt->ast->tag == Block) { + add_line(&code, + Texts("do\n", indent, single_indent, fmt(stmt->ast, comments, Texts(indent, single_indent))), + indent); + } else { + add_line(&code, fmt(stmt->ast, comments, indent), indent); + } comment_pos = stmt->ast->end; if (stmt->next) { |
