zig fmt: fix extern function with missing param name
Regressed in d7049fc8e0.
This commit is contained in:
@@ -4190,6 +4190,17 @@ test "zig fmt: function with labeled block as return type" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: extern function with missing param name" {
|
||||
try testCanonical(
|
||||
\\extern fn a(
|
||||
\\ *b,
|
||||
\\ c: *d,
|
||||
\\) e;
|
||||
\\extern fn f(*g, h: *i) j;
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: line comment after multiline single expr if statement with multiline string" {
|
||||
try testCanonical(
|
||||
\\test {
|
||||
|
||||
@@ -1449,9 +1449,11 @@ fn renderFnProto(gpa: *Allocator, ais: *Ais, tree: ast.Tree, fn_proto: ast.full.
|
||||
continue;
|
||||
},
|
||||
.r_paren => break,
|
||||
else => unreachable,
|
||||
else => {}, // Parameter type without a name.
|
||||
}
|
||||
if (token_tags[last_param_token] == .identifier) {
|
||||
if (token_tags[last_param_token] == .identifier and
|
||||
token_tags[last_param_token + 1] == .colon)
|
||||
{
|
||||
try renderToken(ais, tree, last_param_token, .none); // name
|
||||
last_param_token += 1;
|
||||
try renderToken(ais, tree, last_param_token, .space); // :
|
||||
|
||||
Reference in New Issue
Block a user