| author | |
| committer | |
| log | db4c15be507a55f63b7f19dd4cdc10717f44eb06 |
| tree | a8cb11233a939fb1f6187cbbdd60df43c08c1789 |
| parent | bf642204b373e01314ecfb0c50a643dc4b05746f |
2 files changed, 18 insertions(+), 12 deletions(-)
lib/std/zig/ast.zig+8-1| ... | ... | @@ -321,7 +321,6 @@ pub const Tree = struct { |
| 321 | 321 | while (true) switch (tags[n]) { |
| 322 | 322 | .root => return 0, |
| 323 | 323 | |
| 324 | .@"usingnamespace", | |
| 325 | 324 | .test_decl, |
| 326 | 325 | .@"errdefer", |
| 327 | 326 | .@"defer", |
| ... | ... | @@ -468,6 +467,14 @@ pub const Tree = struct { |
| 468 | 467 | return i - end_offset; |
| 469 | 468 | }, |
| 470 | 469 | |
| 470 | .@"usingnamespace" => { | |
| 471 | const main_token = main_tokens[n]; | |
| 472 | if (main_token > 0 and token_tags[main_token - 1] == .keyword_pub) { | |
| 473 | end_offset += 1; | |
| 474 | } | |
| 475 | return main_token - end_offset; | |
| 476 | }, | |
| 477 | ||
| 471 | 478 | .async_call_one, |
| 472 | 479 | .async_call_one_comma, |
| 473 | 480 | .async_call, |
lib/std/zig/parser_test.zig+10-11| ... | ... | @@ -4178,17 +4178,16 @@ test "zig fmt: for loop with ptr payload and index" { |
| 4178 | 4178 | // ); |
| 4179 | 4179 | //} |
| 4180 | 4180 | |
| 4181 | // TODO | |
| 4182 | //test "zig fmt: respect extra newline between fn and pub usingnamespace" { | |
| 4183 | // try testCanonical( | |
| 4184 | // \\fn foo() void { | |
| 4185 | // \\ bar(); | |
| 4186 | // \\} | |
| 4187 | // \\ | |
| 4188 | // \\pub usingnamespace baz; | |
| 4189 | // \\ | |
| 4190 | // ); | |
| 4191 | //} | |
| 4181 | test "zig fmt: respect extra newline between fn and pub usingnamespace" { | |
| 4182 | try testCanonical( | |
| 4183 | \\fn foo() void { | |
| 4184 | \\ bar(); | |
| 4185 | \\} | |
| 4186 | \\ | |
| 4187 | \\pub usingnamespace baz; | |
| 4188 | \\ | |
| 4189 | ); | |
| 4190 | } | |
| 4192 | 4191 | |
| 4193 | 4192 | // TODO |
| 4194 | 4193 | //test "zig fmt: respect extra newline between switch items" { |