mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
fix parsing of assignment with 'inline for' and 'inline while'
This commit is contained in:
parent
34cb5934dd
commit
272ae0ca0d
@ -1981,7 +1981,7 @@ const Parser = struct {
|
||||
}
|
||||
},
|
||||
.keyword_inline => {
|
||||
p.tok_i += 2;
|
||||
p.tok_i += 1;
|
||||
switch (p.token_tags[p.tok_i]) {
|
||||
.keyword_for => return p.parseForExpr(),
|
||||
.keyword_while => return p.parseWhileExpr(),
|
||||
|
||||
@ -4297,6 +4297,18 @@ test "zig fmt: respect extra newline between switch items" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: assignment with inline for and inline while" {
|
||||
try testCanonical(
|
||||
\\const tmp = inline for (items) |item| {};
|
||||
\\
|
||||
);
|
||||
|
||||
try testCanonical(
|
||||
\\const tmp2 = inline while (true) {};
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: insert trailing comma if there are comments between switch values" {
|
||||
try testTransform(
|
||||
\\const a = switch (b) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user