diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-25 21:10:53 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-26 19:28:38 -0400 |
| commit | 0d767601f59dbe3e700047f6bc3937daa346c148 (patch) | |
| tree | 874a954d7b8098a35a1143997972d96f1d47a02c /src | |
| parent | 5782a7aa19e2bc95450bb0099407f38407e8bc2d (diff) | |
Correctly format types with a long value decl
Diffstat (limited to 'src')
| -rw-r--r-- | src/odin/printer/visit.odin | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/odin/printer/visit.odin b/src/odin/printer/visit.odin index 1adc276..2b948a5 100644 --- a/src/odin/printer/visit.odin +++ b/src/odin/printer/visit.odin @@ -340,13 +340,12 @@ visit_decl :: proc(p: ^Printer, decl: ^ast.Decl, called_in_stmt := false) -> ^Do rhs = cons_with_nopl(rhs, visit_exprs(p, v.values, {.Add_Comma}, .Value_Decl)) } else if len(v.values) > 0 && v.type != nil { - rhs = cons_with_nopl( - rhs, - cons_with_nopl( - text(" :" if p.config.spaces_around_colons else ":"), - visit_exprs(p, v.values, {.Add_Comma}), - ), - ) + if v.type != nil { + lhs = cons_with_nopl(lhs, text(":")) + } else { + lhs = cons(lhs, text(":")) + } + rhs = cons_with_nopl(rhs, visit_exprs(p, v.values, {.Add_Comma})) } else { rhs = cons_with_nopl(rhs, visit_exprs(p, v.values, {.Add_Comma}, .Value_Decl)) } |