aboutsummaryrefslogtreecommitdiff
path: root/src/formatter/formatter.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-09-24 21:20:44 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-09-24 21:20:44 -0400
commit0cfae753aa131f949253f3fba1e3a36c2bde6ac0 (patch)
treed1403a97d7e86f547f8e6ca9994095f31c37d2a2 /src/formatter/formatter.c
parent76f80f80ff1788af96ae87fa909c130336d5399b (diff)
Revert "Deprecate `defer`"
This reverts commit 7e3e245f6809946ea06ef1998bcabb7e0902fbd7.
Diffstat (limited to 'src/formatter/formatter.c')
-rw-r--r--src/formatter/formatter.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/formatter/formatter.c b/src/formatter/formatter.c
index 12f08810..2d220493 100644
--- a/src/formatter/formatter.c
+++ b/src/formatter/formatter.c
@@ -128,6 +128,8 @@ OptionalText_t format_inline_code(ast_t *ast, Table_t comments) {
Text_t message = fmt_inline(assert->message, comments);
return Texts("assert ", expr, ", ", message);
}
+ /*inline*/ case Defer:
+ return Texts("defer ", fmt_inline(Match(ast, Defer)->body, comments));
/*inline*/ case Lambda: {
DeclareMatch(lambda, ast, Lambda);
Text_t code = Texts("func(", format_inline_args(lambda->args, comments));
@@ -573,6 +575,8 @@ Text_t format_code(ast_t *ast, Table_t comments, Text_t indent) {
DeclareMatch(extend, ast, Extend);
return Texts("lang ", Text$from_str(extend->name), format_namespace(extend->body, comments, indent));
}
+ /*multiline*/ case Defer:
+ return Texts("defer ", format_namespace(Match(ast, Defer)->body, comments, indent));
/*multiline*/ case List: {
if (inlined_fits) return inlined;
ast_list_t *items = Match(ast, List)->items;