mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Treat (pattern) as grouping parens. (#6976)
Do not treat it as a 1-tuple pattern as we used to. The design indicates that `(pattern)` is invalid, but this appears to be an oversight, and grouping parens appear to be the intended interpretation. --------- Co-authored-by: Geoff Romer <gromer@google.com>
This commit is contained in:
co-authored by
Geoff Romer
parent
a2ba7f1262
commit
899e54de36
@@ -66,6 +66,16 @@ auto HandleParseNode(Context& context, Parse::ExplicitParamListId node_id)
|
||||
Parse::NodeKind::ExplicitParamListStart);
|
||||
}
|
||||
|
||||
auto HandleParseNode(Context& context, Parse::ParenPatternId node_id) -> bool {
|
||||
EndSubpatternAsNonExpr(context);
|
||||
auto pattern_id = context.node_stack().PopPattern();
|
||||
context.param_and_arg_refs_stack().PopAndDiscard();
|
||||
context.node_stack()
|
||||
.PopAndDiscardSoloNodeId<Parse::NodeKind::TuplePatternStart>();
|
||||
context.node_stack().Push(node_id, pattern_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
auto HandleParseNode(Context& context, Parse::TuplePatternId node_id) -> bool {
|
||||
if (context.node_stack().PeekIs(Parse::NodeKind::TuplePatternStart)) {
|
||||
// End the subpattern started by a trailing comma, or the opening delimiter
|
||||
|
||||
Reference in New Issue
Block a user