diff options
| -rw-r--r-- | src/odin/printer/visit.odin | 2 | ||||
| -rw-r--r-- | tools/odinfmt/tests/allman/.snapshots/switch.odin | 17 | ||||
| -rw-r--r-- | tools/odinfmt/tests/allman/odinfmt.json | 3 | ||||
| -rw-r--r-- | tools/odinfmt/tests/allman/switch.odin | 18 |
4 files changed, 40 insertions, 0 deletions
diff --git a/src/odin/printer/visit.odin b/src/odin/printer/visit.odin index e135825..0911496 100644 --- a/src/odin/printer/visit.odin +++ b/src/odin/printer/visit.odin @@ -1042,7 +1042,9 @@ visit_stmt :: proc( } document = cons_with_opl(document, visit_expr(p, v.cond)) + set_source_position(p, v.body.pos) document = cons_with_nopl(document, visit_stmt(p, v.body, .Switch_Stmt)) + set_source_position(p, v.body.end) case ^Case_Clause: document = cons(document, text("case")) diff --git a/tools/odinfmt/tests/allman/.snapshots/switch.odin b/tools/odinfmt/tests/allman/.snapshots/switch.odin new file mode 100644 index 0000000..9eef4a9 --- /dev/null +++ b/tools/odinfmt/tests/allman/.snapshots/switch.odin @@ -0,0 +1,17 @@ +package allman + +main :: proc() { + num := 1 + + switch num { + case 0: + case 1: + } + + switch num { + case 0: + case 1: + } + + +} diff --git a/tools/odinfmt/tests/allman/odinfmt.json b/tools/odinfmt/tests/allman/odinfmt.json new file mode 100644 index 0000000..d6ebe98 --- /dev/null +++ b/tools/odinfmt/tests/allman/odinfmt.json @@ -0,0 +1,3 @@ +{ + "brace_style": "Allman" +} diff --git a/tools/odinfmt/tests/allman/switch.odin b/tools/odinfmt/tests/allman/switch.odin new file mode 100644 index 0000000..b68f9bc --- /dev/null +++ b/tools/odinfmt/tests/allman/switch.odin @@ -0,0 +1,18 @@ +package allman + +main :: proc() { + num := 1 + + switch num + { + case 0: + case 1: + } + + switch num { + case 0: + case 1: + } + + +}
\ No newline at end of file |