From 1824f840c1564c59eaecfaa25556d4e830d867bc Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 30 Aug 2025 14:36:28 -0400 Subject: Add 'do' wrapper on blocks --- src/formatter/formatter.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) { -- cgit v1.2.3