| author | |
| committer | |
| log | 4809e0ea7f53d1b56cbc4c6e62e4b8ea40936d44 |
| tree | 51ae7741cafe23082b9727780a531a92048752ea |
| parent | 901c3e96368bd9fa9ee9858c0295ee05ef1d7146 |
| signature |
2 files changed, 10 insertions(+), 3 deletions(-)
lib/std/zig/Ast.zig+3-3| ... | @@ -2189,9 +2189,9 @@ fn fullCall(tree: Ast, info: full.Call.Components) full.Call { | ... | @@ -2189,9 +2189,9 @@ fn fullCall(tree: Ast, info: full.Call.Components) full.Call { |
| 2189 | .ast = info, | 2189 | .ast = info, |
| 2190 | .async_token = null, | 2190 | .async_token = null, |
| 2191 | }; | 2191 | }; |
| 2192 | const maybe_async_token = tree.firstToken(info.fn_expr) - 1; | 2192 | const first_token = tree.firstToken(info.fn_expr); |
| 2193 | if (token_tags[maybe_async_token] == .keyword_async) { | 2193 | if (first_token != 0 and token_tags[first_token - 1] == .keyword_async) { |
| 2194 | result.async_token = maybe_async_token; | 2194 | result.async_token = first_token - 1; |
| 2195 | } | 2195 | } |
| 2196 | return result; | 2196 | return result; |
| 2197 | } | 2197 | } |
lib/std/zig/parser_test.zig+7| ... | @@ -214,6 +214,13 @@ test "zig fmt: top-level fields" { | ... | @@ -214,6 +214,13 @@ test "zig fmt: top-level fields" { |
| 214 | ); | 214 | ); |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | test "zig fmt: top-level tuple function call type" { | ||
| 218 | try testCanonical( | ||
| 219 | \\foo() | ||
| 220 | \\ | ||
| 221 | ); | ||
| 222 | } | ||
| 223 | |||
| 217 | test "zig fmt: C style containers" { | 224 | test "zig fmt: C style containers" { |
| 218 | try testError( | 225 | try testError( |
| 219 | \\struct Foo { | 226 | \\struct Foo { |