mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 09:11:05 +01:00
Remove forward references from binding patterns (#4494)
This is primarily to free up space in the BindingPattern insts, but as a side effect it moves the link between BindingPattern and its BindName out of the SemIR, and into a transient data structure in Context. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
10e256a241
commit
5759ad8b42
@@ -216,18 +216,20 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
|
||||
context.AddNameToLookup(name_id, bind_id);
|
||||
auto entity_name_id =
|
||||
context.insts().GetAs<SemIR::AnyBindName>(bind_id).entity_name_id;
|
||||
bool inserted = context.bind_name_cache()
|
||||
.Insert(entity_name_id, bind_id)
|
||||
.is_inserted();
|
||||
CARBON_CHECK(inserted);
|
||||
auto pattern_inst_id = SemIR::InstId::Invalid;
|
||||
if (is_generic) {
|
||||
pattern_inst_id =
|
||||
context.AddPatternInst<SemIR::SymbolicBindingPattern>(
|
||||
name_node, {.type_id = cast_type_id,
|
||||
.entity_name_id = entity_name_id,
|
||||
.bind_name_id = bind_id});
|
||||
name_node,
|
||||
{.type_id = cast_type_id, .entity_name_id = entity_name_id});
|
||||
} else {
|
||||
pattern_inst_id = context.AddPatternInst<SemIR::BindingPattern>(
|
||||
name_node, {.type_id = cast_type_id,
|
||||
.entity_name_id = entity_name_id,
|
||||
.bind_name_id = bind_id});
|
||||
name_node,
|
||||
{.type_id = cast_type_id, .entity_name_id = entity_name_id});
|
||||
}
|
||||
param_pattern_id = context.AddPatternInst<SemIR::ValueParamPattern>(
|
||||
node_id,
|
||||
|
||||
Reference in New Issue
Block a user