mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
zig fmt: fix firstToken() for extern fn_protos
This commit is contained in:
parent
550688f427
commit
45634851de
@ -366,10 +366,6 @@ pub const Tree = struct {
|
||||
.@"nosuspend",
|
||||
.asm_simple,
|
||||
.@"asm",
|
||||
.fn_proto_simple,
|
||||
.fn_proto_multi,
|
||||
.fn_proto_one,
|
||||
.fn_proto,
|
||||
.array_type,
|
||||
.array_type_sentinel,
|
||||
.error_value,
|
||||
@ -449,7 +445,12 @@ pub const Tree = struct {
|
||||
.error_union,
|
||||
=> n = datas[n].lhs,
|
||||
|
||||
.fn_decl => {
|
||||
.fn_decl,
|
||||
.fn_proto_simple,
|
||||
.fn_proto_multi,
|
||||
.fn_proto_one,
|
||||
.fn_proto,
|
||||
=> {
|
||||
var i = main_tokens[n]; // fn token
|
||||
while (i > 0) {
|
||||
i -= 1;
|
||||
|
||||
@ -3727,24 +3727,24 @@ test "zig fmt: Don't add extra newline after if" {
|
||||
);
|
||||
}
|
||||
|
||||
//test "zig fmt: comments in ternary ifs" {
|
||||
// try testCanonical(
|
||||
// \\const x = if (true) {
|
||||
// \\ 1;
|
||||
// \\} else if (false)
|
||||
// \\ // Comment
|
||||
// \\ 0;
|
||||
// \\const y = if (true)
|
||||
// \\ // Comment
|
||||
// \\ 1
|
||||
// \\else
|
||||
// \\ 0;
|
||||
// \\
|
||||
// \\pub extern "c" fn printf(format: [*:0]const u8, ...) c_int;
|
||||
// \\
|
||||
// );
|
||||
//}
|
||||
//
|
||||
test "zig fmt: comments in ternary ifs" {
|
||||
try testCanonical(
|
||||
\\const x = if (true) {
|
||||
\\ 1;
|
||||
\\} else if (false)
|
||||
\\ // Comment
|
||||
\\ 0;
|
||||
\\const y = if (true)
|
||||
\\ // Comment
|
||||
\\ 1
|
||||
\\else
|
||||
\\ 0;
|
||||
\\
|
||||
\\pub extern "c" fn printf(format: [*:0]const u8, ...) c_int;
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
//test "zig fmt: test comments in field access chain" {
|
||||
// try testCanonical(
|
||||
// \\pub const str = struct {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user