authorgravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-02-22 23:51:15+01:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-02-22 23:51:54+01:00
log45634851de92f7848b648a0e009247e7f102e9ff
tree118d24d1208210484cee42d8c0b3362c3b8afeed
parent550688f427a2303f5e309a269def4d8be532cc54
signaturelock-open Commit is signed but in an unrecognized format.

zig fmt: fix firstToken() for extern fn_protos


2 files changed, 24 insertions(+), 23 deletions(-)

lib/std/zig/ast.zig+6-5
...@@ -366,10 +366,6 @@ pub const Tree = struct {...@@ -366,10 +366,6 @@ pub const Tree = struct {
366 .@"nosuspend",366 .@"nosuspend",
367 .asm_simple,367 .asm_simple,
368 .@"asm",368 .@"asm",
369 .fn_proto_simple,
370 .fn_proto_multi,
371 .fn_proto_one,
372 .fn_proto,
373 .array_type,369 .array_type,
374 .array_type_sentinel,370 .array_type_sentinel,
375 .error_value,371 .error_value,
...@@ -449,7 +445,12 @@ pub const Tree = struct {...@@ -449,7 +445,12 @@ pub const Tree = struct {
449 .error_union,445 .error_union,
450 => n = datas[n].lhs,446 => n = datas[n].lhs,
451447
452 .fn_decl => {448 .fn_decl,
449 .fn_proto_simple,
450 .fn_proto_multi,
451 .fn_proto_one,
452 .fn_proto,
453 => {
453 var i = main_tokens[n]; // fn token454 var i = main_tokens[n]; // fn token
454 while (i > 0) {455 while (i > 0) {
455 i -= 1;456 i -= 1;
lib/std/zig/parser_test.zig+18-18
...@@ -3727,24 +3727,24 @@ test "zig fmt: Don't add extra newline after if" {...@@ -3727,24 +3727,24 @@ test "zig fmt: Don't add extra newline after if" {
3727 );3727 );
3728}3728}
37293729
3730//test "zig fmt: comments in ternary ifs" {3730test "zig fmt: comments in ternary ifs" {
3731// try testCanonical(3731 try testCanonical(
3732// \\const x = if (true) {3732 \\const x = if (true) {
3733// \\ 1;3733 \\ 1;
3734// \\} else if (false)3734 \\} else if (false)
3735// \\ // Comment3735 \\ // Comment
3736// \\ 0;3736 \\ 0;
3737// \\const y = if (true)3737 \\const y = if (true)
3738// \\ // Comment3738 \\ // Comment
3739// \\ 13739 \\ 1
3740// \\else3740 \\else
3741// \\ 0;3741 \\ 0;
3742// \\3742 \\
3743// \\pub extern "c" fn printf(format: [*:0]const u8, ...) c_int;3743 \\pub extern "c" fn printf(format: [*:0]const u8, ...) c_int;
3744// \\3744 \\
3745// );3745 );
3746//}3746}
3747//3747
3748//test "zig fmt: test comments in field access chain" {3748//test "zig fmt: test comments in field access chain" {
3749// try testCanonical(3749// try testCanonical(
3750// \\pub const str = struct {3750// \\pub const str = struct {