authorgravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-02-10 13:02:37+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-02-10 11:53:53-08:00
log80b719d967d7241182e237b42ade1cd88494c8e8
treec6d946a59bbcdd12d9d178318ad7e51cd620033e
parent58db3d27753709074fba7c88923754dd1c1a0ed9

zig fmt: fix typo in firstToken() for pointer types


2 files changed, 25 insertions(+), 25 deletions(-)

lib/std/zig/ast.zig+2-2
...@@ -408,10 +408,10 @@ pub const Tree = struct {...@@ -408,10 +408,10 @@ pub const Tree = struct {
408 const main_token = main_tokens[n];408 const main_token = main_tokens[n];
409 return switch (token_tags[main_token]) {409 return switch (token_tags[main_token]) {
410 .Asterisk => switch (token_tags[main_token - 1]) {410 .Asterisk => switch (token_tags[main_token - 1]) {
411 .LBrace => main_token - 1,411 .LBracket => main_token - 1,
412 else => main_token,412 else => main_token,
413 },413 },
414 .LBrace => main_token,414 .LBracket => main_token,
415 else => unreachable,415 else => unreachable,
416 } - end_offset;416 } - end_offset;
417 },417 },
lib/std/zig/parser_test.zig+23-23
...@@ -423,16 +423,16 @@ test "zig fmt: sentinel slice with modifiers" {...@@ -423,16 +423,16 @@ test "zig fmt: sentinel slice with modifiers" {
423 );423 );
424}424}
425425
426//test "zig fmt: anon literal in array" {426test "zig fmt: anon literal in array" {
427// try testCanonical(427 try testCanonical(
428// \\var arr: [2]Foo = .{428 \\var arr: [2]Foo = .{
429// \\ .{ .a = 2 },429 \\ .{ .a = 2 },
430// \\ .{ .b = 3 },430 \\ .{ .b = 3 },
431// \\};431 \\};
432// \\432 \\
433// );433 );
434//}434}
435//435
436//test "zig fmt: alignment in anonymous literal" {436//test "zig fmt: alignment in anonymous literal" {
437// try testTransform(437// try testTransform(
438// \\const a = .{438// \\const a = .{
...@@ -751,12 +751,12 @@ test "zig fmt: tagged union with enum values" {...@@ -751,12 +751,12 @@ test "zig fmt: tagged union with enum values" {
751 );751 );
752}752}
753753
754//test "zig fmt: allowzero pointer" {754test "zig fmt: allowzero pointer" {
755// try testCanonical(755 try testCanonical(
756// \\const T = [*]allowzero const u8;756 \\const T = [*]allowzero const u8;
757// \\757 \\
758// );758 );
759//}759}
760760
761test "zig fmt: enum literal" {761test "zig fmt: enum literal" {
762 try testCanonical(762 try testCanonical(
...@@ -806,13 +806,13 @@ test "zig fmt: character literal larger than u8" {...@@ -806,13 +806,13 @@ test "zig fmt: character literal larger than u8" {
806// \\806// \\
807// );807// );
808//}808//}
809//809
810//test "zig fmt: C pointers" {810test "zig fmt: C pointers" {
811// try testCanonical(811 try testCanonical(
812// \\const Ptr = [*c]i32;812 \\const Ptr = [*c]i32;
813// \\813 \\
814// );814 );
815//}815}
816816
817test "zig fmt: threadlocal" {817test "zig fmt: threadlocal" {
818 try testCanonical(818 try testCanonical(