mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Support tuple patterns outside parameter lists (#4923)
Parameter lists need substantially different treatment than tuple patterns in other contexts, so this change splits them into separate parse node kinds. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
35f5a7f115
commit
74e1a9949f
@@ -373,8 +373,8 @@ class NodeStack {
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: Patterns should also produce an `InstId`, but currently
|
||||
// `TuplePattern` produces an `InstBlockId`.
|
||||
set_id_if_category_is(Parse::NodeCategory::Pattern,
|
||||
Id::KindFor<SemIR::InstId>());
|
||||
set_id_if_category_is(Parse::NodeCategory::Expr,
|
||||
Id::KindFor<SemIR::InstId>());
|
||||
set_id_if_category_is(Parse::NodeCategory::MemberName |
|
||||
@@ -394,23 +394,18 @@ class NodeStack {
|
||||
static constexpr auto NodeKindToIdKindSpecialCases(Parse::NodeKind node_kind)
|
||||
-> std::optional<Id::Kind> {
|
||||
switch (node_kind) {
|
||||
case Parse::NodeKind::Addr:
|
||||
case Parse::NodeKind::CallExprStart:
|
||||
case Parse::NodeKind::CompileTimeBindingPattern:
|
||||
case Parse::NodeKind::IfExprThen:
|
||||
case Parse::NodeKind::LetBindingPattern:
|
||||
case Parse::NodeKind::ReturnType:
|
||||
case Parse::NodeKind::ShortCircuitOperandAnd:
|
||||
case Parse::NodeKind::ShortCircuitOperandOr:
|
||||
case Parse::NodeKind::StructLiteralField:
|
||||
case Parse::NodeKind::VarBindingPattern:
|
||||
case Parse::NodeKind::VariablePattern:
|
||||
case Parse::NodeKind::WhereOperand:
|
||||
return Id::KindFor<SemIR::InstId>();
|
||||
case Parse::NodeKind::ExplicitParamList:
|
||||
case Parse::NodeKind::IfCondition:
|
||||
case Parse::NodeKind::IfExprIf:
|
||||
case Parse::NodeKind::ImplicitParamList:
|
||||
case Parse::NodeKind::TuplePattern:
|
||||
case Parse::NodeKind::WhileCondition:
|
||||
case Parse::NodeKind::WhileConditionStart:
|
||||
return Id::KindFor<SemIR::InstBlockId>();
|
||||
@@ -436,6 +431,7 @@ class NodeStack {
|
||||
case Parse::NodeKind::ChoiceIntroducer:
|
||||
case Parse::NodeKind::ClassIntroducer:
|
||||
case Parse::NodeKind::CodeBlockStart:
|
||||
case Parse::NodeKind::ExplicitParamListStart:
|
||||
case Parse::NodeKind::FunctionIntroducer:
|
||||
case Parse::NodeKind::IfStatementElse:
|
||||
case Parse::NodeKind::ImplicitParamListStart:
|
||||
|
||||
Reference in New Issue
Block a user