mirror of
https://github.com/ziglang/zig.git
synced 2025-12-14 10:13:07 +00:00
zig fmt: for loop with ptr payload and index
This commit is contained in:
parent
988f1c6a6f
commit
4420fe97be
@ -4152,6 +4152,18 @@ test "zig fmt: space after top level doc comment" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: for loop with ptr payload and index" {
|
||||
try testCanonical(
|
||||
\\test {
|
||||
\\ for (self.entries.items) |*item, i| {}
|
||||
\\ for (self.entries.items) |*item, i|
|
||||
\\ a = b;
|
||||
\\ for (self.entries.items) |*item, i| a = b;
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: error for invalid bit range" {
|
||||
try testError(
|
||||
\\var x: []align(0:0:0)u8 = bar;
|
||||
|
||||
@ -1040,7 +1040,7 @@ fn renderWhile(gpa: *Allocator, ais: *Ais, tree: ast.Tree, while_node: ast.full.
|
||||
if (token_tags[ident + 1] == .comma) {
|
||||
try renderToken(ais, tree, ident + 1, .space); // ,
|
||||
try renderToken(ais, tree, ident + 2, .none); // index
|
||||
break :blk payload_token + 3;
|
||||
break :blk ident + 3;
|
||||
} else {
|
||||
break :blk ident + 1;
|
||||
}
|
||||
@ -1102,7 +1102,7 @@ fn renderWhile(gpa: *Allocator, ais: *Ais, tree: ast.Tree, while_node: ast.full.
|
||||
if (token_tags[ident + 1] == .comma) {
|
||||
try renderToken(ais, tree, ident + 1, .space); // ,
|
||||
try renderToken(ais, tree, ident + 2, .none); // index
|
||||
break :blk payload_token + 3;
|
||||
break :blk ident + 3;
|
||||
} else {
|
||||
break :blk ident + 1;
|
||||
}
|
||||
@ -1177,7 +1177,7 @@ fn renderWhile(gpa: *Allocator, ais: *Ais, tree: ast.Tree, while_node: ast.full.
|
||||
if (token_tags[ident + 1] == .comma) {
|
||||
try renderToken(ais, tree, ident + 1, .space); // ,
|
||||
try renderToken(ais, tree, ident + 2, .none); // index
|
||||
break :blk payload_token + 3;
|
||||
break :blk ident + 3;
|
||||
} else {
|
||||
break :blk ident + 1;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user