diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-08-30 13:59:51 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-08-30 13:59:51 -0400 |
| commit | 351a79b5d7c20f806b66fed19407677402ad0805 (patch) | |
| tree | 740e060828e5c234029edb86028738ba88f0ba47 /src | |
| parent | db4048734179c047d64284281f72a531f166f11e (diff) | |
Formatting tweak for enums
Diffstat (limited to 'src')
| -rw-r--r-- | src/formatter/enums.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/formatter/enums.c b/src/formatter/enums.c index 7a89705d..893f055b 100644 --- a/src/formatter/enums.c +++ b/src/formatter/enums.c @@ -9,18 +9,25 @@ OptionalText_t format_inline_tag(tag_ast_t *tag, Table_t comments) { if (range_has_comment(tag->start, tag->end, comments)) return NONE_TEXT; - Text_t code = Texts(Text$from_str(tag->name), "(", must(format_inline_args(tag->fields, comments))); - if (tag->secret) code = Texts(code, "; secret"); - return Texts(code, ")"); + Text_t code = Text$from_str(tag->name); + if (tag->fields || tag->secret) { + code = Texts(code, "(", must(format_inline_args(tag->fields, comments))); + if (tag->secret) code = Texts(code, "; secret"); + code = Texts(code, ")"); + } + return code; } Text_t format_tag(tag_ast_t *tag, Table_t comments, Text_t indent) { OptionalText_t inline_tag = format_inline_tag(tag, comments); if (inline_tag.length >= 0) return inline_tag; - Text_t code = - Texts(Text$from_str(tag->name), "(", format_args(tag->fields, comments, Texts(indent, single_indent))); - if (tag->secret) code = Texts(code, "; secret"); - return Texts(code, ")"); + Text_t code = Text$from_str(tag->name); + if (tag->fields || tag->secret) { + code = Texts(code, "(", format_args(tag->fields, comments, Texts(indent, single_indent))); + if (tag->secret) code = Texts(code, "; secret"); + code = Texts(code, ")"); + } + return code; } OptionalText_t format_inline_tags(tag_ast_t *tags, Table_t comments) { |
