mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 09:41:05 +01:00
Remove index fields from ParamPatterns (#6815)
This is a step toward removing the index from `InitForm`, so that equal form values always have equal representations. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
9ff6b0a682
commit
6dba8ee111
@@ -280,24 +280,21 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
|
||||
if (node_kind == Parse::NodeKind::LetBindingPattern ||
|
||||
node_kind == Parse::NodeKind::FormBindingPattern) {
|
||||
auto type_id = context.insts().GetAttachedType(result_inst_id);
|
||||
// Allocate a dummy index to preserve index of subsequent `InitForm`s.
|
||||
// TODO: Remove this once we remove `InitForm::index`.
|
||||
context.full_pattern_stack().NextCallParamIndex();
|
||||
if (is_ref) {
|
||||
result_inst_id = AddPatternInst<SemIR::RefParamPattern>(
|
||||
context, node_id,
|
||||
{.type_id = type_id,
|
||||
.subpattern_id = result_inst_id,
|
||||
.index = context.full_pattern_stack().NextCallParamIndex()});
|
||||
{.type_id = type_id, .subpattern_id = result_inst_id});
|
||||
} else if (node_kind == Parse::NodeKind::FormBindingPattern) {
|
||||
result_inst_id = AddPatternInst<SemIR::FormParamPattern>(
|
||||
context, node_id,
|
||||
{.type_id = type_id,
|
||||
.subpattern_id = result_inst_id,
|
||||
.index = context.full_pattern_stack().NextCallParamIndex()});
|
||||
{.type_id = type_id, .subpattern_id = result_inst_id});
|
||||
} else {
|
||||
result_inst_id = AddPatternInst<SemIR::ValueParamPattern>(
|
||||
context, node_id,
|
||||
{.type_id = type_id,
|
||||
.subpattern_id = result_inst_id,
|
||||
.index = context.full_pattern_stack().NextCallParamIndex()});
|
||||
{.type_id = type_id, .subpattern_id = result_inst_id});
|
||||
}
|
||||
}
|
||||
context.node_stack().Push(node_id, result_inst_id);
|
||||
|
||||
Reference in New Issue
Block a user