trailing commas
This commit is contained in:
@@ -714,6 +714,7 @@ pub const Parser = struct {
|
||||
while (self.current.tag != .r_paren and self.current.tag != .eof) {
|
||||
if (type_params.items.len > 0) {
|
||||
try self.expect(.comma);
|
||||
if (self.current.tag == .r_paren) break;
|
||||
}
|
||||
// Expect $name : constraint
|
||||
try self.expect(.dollar);
|
||||
@@ -899,6 +900,7 @@ pub const Parser = struct {
|
||||
while (self.current.tag != .r_paren and self.current.tag != .eof) {
|
||||
if (param_types.items.len > 0) {
|
||||
try self.expect(.comma);
|
||||
if (self.current.tag == .r_paren) break;
|
||||
}
|
||||
// Parse: name: type
|
||||
if (self.current.tag != .identifier and self.current.tag != .kw_Self) {
|
||||
@@ -976,6 +978,7 @@ pub const Parser = struct {
|
||||
while (self.current.tag != .r_paren and self.current.tag != .eof) {
|
||||
if (target_type_params.items.len > 0) {
|
||||
try self.expect(.comma);
|
||||
if (self.current.tag == .r_paren) break;
|
||||
}
|
||||
try self.expect(.dollar);
|
||||
if (self.current.tag != .identifier) {
|
||||
@@ -1036,6 +1039,7 @@ pub const Parser = struct {
|
||||
while (self.current.tag != .r_brace and self.current.tag != .eof) {
|
||||
if (field_inits.items.len > 0) {
|
||||
try self.expect(.comma);
|
||||
if (self.current.tag == .r_brace) break;
|
||||
}
|
||||
|
||||
// Check if this is a named field: identifier followed by '='
|
||||
@@ -1104,6 +1108,7 @@ pub const Parser = struct {
|
||||
while (self.current.tag != .r_paren and self.current.tag != .eof) {
|
||||
if (params.items.len > 0) {
|
||||
try self.expect(.comma);
|
||||
if (self.current.tag == .r_paren) break;
|
||||
}
|
||||
var is_ct_param = false;
|
||||
if (self.current.tag == .dollar) {
|
||||
@@ -1606,6 +1611,7 @@ pub const Parser = struct {
|
||||
while (self.current.tag != .r_paren and self.current.tag != .eof) {
|
||||
if (args.items.len > 0) {
|
||||
try self.expect(.comma);
|
||||
if (self.current.tag == .r_paren) break;
|
||||
}
|
||||
// Spread operator: ..expr
|
||||
if (self.current.tag == .dot_dot) {
|
||||
@@ -1641,6 +1647,7 @@ pub const Parser = struct {
|
||||
while (self.current.tag != .r_bracket and self.current.tag != .eof) {
|
||||
if (elements.items.len > 0) {
|
||||
try self.expect(.comma);
|
||||
if (self.current.tag == .r_bracket) break;
|
||||
}
|
||||
const elem = try self.parseExpr();
|
||||
try elements.append(self.allocator, elem);
|
||||
@@ -1805,6 +1812,7 @@ pub const Parser = struct {
|
||||
while (self.current.tag != .r_bracket and self.current.tag != .eof) {
|
||||
if (elements.items.len > 0) {
|
||||
try self.expect(.comma);
|
||||
if (self.current.tag == .r_bracket) break;
|
||||
}
|
||||
const elem = try self.parseExpr();
|
||||
try elements.append(self.allocator, elem);
|
||||
@@ -2203,6 +2211,7 @@ pub const Parser = struct {
|
||||
try elements.append(self.allocator, .{ .name = name, .value = value });
|
||||
if (self.current.tag == .comma) {
|
||||
self.advance();
|
||||
if (self.current.tag == .r_paren) break;
|
||||
} else break;
|
||||
}
|
||||
try self.expect(.r_paren);
|
||||
|
||||
Reference in New Issue
Block a user