Refactor match parse nodes. (#6870)

Use the same node kind for the body of `case` and `default` handlers. We
don't need to distinguish these in check, so don't create extra node
kinds for them.

In order to make the nodes properly delimited, make the label (`case
...` or `default`) nodes be children of the `=>` node rather than
siblings. This allows us to use the node kind of the `=>` as the
bracketing node for the complete handler, rather than having two
different bracketing node kinds, one for each kind of label.
This commit is contained in:
Richard Smith
2026-03-10 20:04:28 +00:00
committed by GitHub
parent 9e2d0a887f
commit 99bde2acb3
20 changed files with 310 additions and 338 deletions
+2 -4
View File
@@ -513,18 +513,16 @@ class NodeStack {
case Parse::NodeKind::InlineImportSpecifier:
case Parse::NodeKind::InlineImportBody:
case Parse::NodeKind::MatchCase:
case Parse::NodeKind::MatchCaseEqualGreater:
case Parse::NodeKind::MatchCaseGuard:
case Parse::NodeKind::MatchCaseGuardIntroducer:
case Parse::NodeKind::MatchCaseGuardStart:
case Parse::NodeKind::MatchCaseIntroducer:
case Parse::NodeKind::MatchCaseStart:
case Parse::NodeKind::MatchCondition:
case Parse::NodeKind::MatchConditionStart:
case Parse::NodeKind::MatchDefault:
case Parse::NodeKind::MatchDefaultEqualGreater:
case Parse::NodeKind::MatchDefaultIntroducer:
case Parse::NodeKind::MatchDefaultStart:
case Parse::NodeKind::MatchHandlerStart:
case Parse::NodeKind::MatchHandler:
case Parse::NodeKind::MatchIntroducer:
case Parse::NodeKind::MatchStatementStart:
case Parse::NodeKind::NamespaceStart: