mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-17 17:10:36 +00:00
allow trailing commas in a struct pattern after an _ field (#8074)
Following a leads decision (https://github.com/carbon-language/carbon-lang/issues/7404), this PR adds support for trailing commas in a struct pattern where it was previously only allowed after a full field.
This commit is contained in:
1 parent
80a4a4d005
commit
5ae3dcaa92
8 files changed
+78
-25
No files matched your search
@@ -167,10 +167,6 @@ auto HandleParseNode(Context& context, Parse::StructPatternId node_id) -> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (context.node_stack().PeekIs(Parse::NodeKind::UnderscoreName)) {
|
||||
return context.TODO(node_id, "Struct pattern underscore field");
|
||||
}
|
||||
|
||||
if (!context.node_stack().PeekIs(Parse::NodeCategory::MemberName)) {
|
||||
// Remove the last parameter from the node stack before collecting names.
|
||||
context.param_and_arg_refs_stack().EndNoPop(
|
||||
@@ -241,6 +237,11 @@ auto HandleParseNode(Context& context,
|
||||
return true;
|
||||
}
|
||||
|
||||
auto HandleParseNode(Context& context,
|
||||
Parse::PatternListUnderscoreFieldId node_id) -> bool {
|
||||
return context.TODO(node_id, "Struct pattern underscore field");
|
||||
}
|
||||
|
||||
auto HandleParseNode(Context& context, Parse::PatternListCommaId /*node_id*/)
|
||||
-> bool {
|
||||
EndExprRegionForPattern(context, context.node_stack());
|
||||
|
||||
Reference in new issue
Block a user