zig fmt: fix firstToken() for switch_case
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user