diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2025-02-08 20:22:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-08 20:22:24 +0100 |
| commit | 6ff5291460f931c0eceef0cc8f9b5e45cd9a78ee (patch) | |
| tree | f3cde82dfda9489caeadd7912830dbd062f7508d /src | |
| parent | 94822db4b5dd90c39020fb48f89532e0f44e7110 (diff) | |
| parent | 2cdf6ecc3bd8290043b79079dec4929cdb540716 (diff) | |
Merge pull request #591 from VaskoBozhurski/master
Do not overwrite brackets for foreign import when value is not a string literal
Diffstat (limited to 'src')
| -rw-r--r-- | src/odin/printer/visit.odin | 8 |
1 files changed, 7 insertions, 1 deletions
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 |