authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-25 11:52:18-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-25 11:54:10-04:00
log3290e728339e49765b1adda78f173befb9fc12bf
treec03bec671475f6a0e73d724715de6c95accaa799
parent8866bef92c8b674c2a444c94326c57984597ab05

std.zig.ast: fix incorrect impl of FnProto.firstToken

closes #1151

2 files changed, 10 insertions(+), 0 deletions(-)

std/zig/ast.zig+1
......@@ -858,6 +858,7 @@ pub const Node = struct {
858858
859859 pub fn firstToken(self: *FnProto) TokenIndex {
860860 if (self.visib_token) |visib_token| return visib_token;
861 if (self.async_attr) |async_attr| return async_attr.firstToken();
861862 if (self.extern_export_inline_token) |extern_export_inline_token| return extern_export_inline_token;
862863 assert(self.lib_name == null);
863864 if (self.cc_token) |cc_token| return cc_token;
std/zig/parser_test.zig+9
......@@ -1,3 +1,12 @@
1test "zig fmt: preserve space between async fn definitions" {
2 try testCanonical(
3 \\async fn a() void {}
4 \\
5 \\async fn b() void {}
6 \\
7 );
8}
9
110test "zig fmt: comment to disable/enable zig fmt first" {
211 try testCanonical(
312 \\// Test trailing comma syntax