mirror of
https://github.com/ziglang/zig.git
synced 2026-02-15 22:09:49 +00:00
zig fmt: fix firstToken() for switch_case
This commit is contained in:
parent
db4c15be50
commit
1b8eca030e
@ -580,7 +580,7 @@ pub const Tree = struct {
|
||||
.switch_case => {
|
||||
const extra = tree.extraData(datas[n].lhs, Node.SubRange);
|
||||
assert(extra.end - extra.start > 0);
|
||||
n = extra.start;
|
||||
n = tree.extra_data[extra.start];
|
||||
},
|
||||
|
||||
.asm_output, .asm_input => {
|
||||
|
||||
@ -4189,19 +4189,18 @@ test "zig fmt: respect extra newline between fn and pub usingnamespace" {
|
||||
);
|
||||
}
|
||||
|
||||
// TODO
|
||||
//test "zig fmt: respect extra newline between switch items" {
|
||||
// try testCanonical(
|
||||
// \\const a = switch (b) {
|
||||
// \\ .c => {},
|
||||
// \\
|
||||
// \\ .d,
|
||||
// \\ .e,
|
||||
// \\ => f,
|
||||
// \\};
|
||||
// \\
|
||||
// );
|
||||
//}
|
||||
test "zig fmt: respect extra newline between switch items" {
|
||||
try testCanonical(
|
||||
\\const a = switch (b) {
|
||||
\\ .c => {},
|
||||
\\
|
||||
\\ .d,
|
||||
\\ .e,
|
||||
\\ => f,
|
||||
\\};
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: error for invalid bit range" {
|
||||
try testError(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user