aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-26 20:15:34 -0400
committerGitHub <noreply@github.com>2025-08-26 20:15:34 -0400
commit8244c527778d082fc3bc8a219bbaa23d3a8b11ea (patch)
tree88a2c03f4f6a29106c94f8ac689f2cdcf4e4ae2d /src
parente211cdcdb8f6ab65fffb24552b89956c06f150cb (diff)
parent0d767601f59dbe3e700047f6bc3937daa346c148 (diff)
Merge pull request #931 from BradLewis/fix/long-value-decl-types
Correctly format types with a long value decl
Diffstat (limited to 'src')
-rw-r--r--src/odin/printer/visit.odin13
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))
}