fn expectParamDecl(p: *Parse) !?Node.Index p: *Parse2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731fn expectParamDecl(p: *Parse) !?Node.Index {
_ = try p.eatDocComments();
switch (p.tokenTag(p.tok_i)) {
.keyword_noalias, .keyword_comptime => p.tok_i += 1,
.ellipsis3 => {
p.tok_i += 1;
return null;
},
else => {},
}
_ = p.eatTokens(&.{ .identifier, .colon });
if (p.eatToken(.keyword_anytype)) |_| {
return null;
} else {
return try p.expectTypeExpr();
}
}
This function can return null nodes and then still return nodes afterwards, such as in the case of anytype and
.... Caller must look for rparen to find out when there are no more param decls left.