From 2cdf6ecc3bd8290043b79079dec4929cdb540716 Mon Sep 17 00:00:00 2001 From: Vasil Bozhurski Date: Sat, 8 Feb 2025 21:03:58 +0200 Subject: do not overwrite brackets for foreign import --- src/odin/printer/visit.odin | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/odin/printer/visit.odin b/src/odin/printer/visit.odin index 0911496..2b0dcd3 100644 --- a/src/odin/printer/visit.odin +++ b/src/odin/printer/visit.odin @@ -243,7 +243,13 @@ visit_decl :: proc(p: ^Printer, decl: ^ast.Decl, called_in_stmt := false) -> ^Do } document = cons(document, text("}")) } else if len(v.fullpaths) == 1 { - document = cons_with_nopl(document, visit_expr(p, v.fullpaths[0])) + if _, ok := v.fullpaths[0].derived_expr.(^ast.Basic_Lit); ok { + document = cons_with_nopl(document, visit_expr(p, v.fullpaths[0])) + } else { + document = cons_with_nopl(document, text("{")) + document = cons(document, visit_expr(p, v.fullpaths[0])) + document = cons(document, text("}")) + } } return document -- cgit v1.2.3