mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Move default value inst ids to a dedicated value store. (#7810)
Per #7737 we move the default value `InstId` storage from a block in the `SemIR::Function` data structure to a `SemIR::File` scoped `ValueStore`. Moves the default value consistency checking to the general merge argument pattern matching logic, which changes the error message issued to the generic one.
This commit is contained in:
@@ -45,10 +45,10 @@ auto PopNameComponent(Context& context, SemIR::InstId return_pattern_id)
|
||||
}
|
||||
|
||||
auto call_param_patterns_id = SemIR::InstBlockId::None;
|
||||
auto call_param_default_values_id = SemIR::InstBlockId::Empty;
|
||||
auto call_params_id = SemIR::InstBlockId::None;
|
||||
auto param_ranges = SemIR::Function::CallParamIndexRanges::Empty;
|
||||
auto pattern_block_id = SemIR::InstBlockId::None;
|
||||
auto unspecified_values_block_id = SemIR::InstBlockId::Empty;
|
||||
if (param_patterns_id->has_value() ||
|
||||
implicit_param_patterns_id->has_value() ||
|
||||
return_pattern_id.has_value()) {
|
||||
@@ -57,11 +57,8 @@ auto PopNameComponent(Context& context, SemIR::InstId return_pattern_id)
|
||||
call_param_patterns_id = results.call_param_patterns_id;
|
||||
call_params_id = results.call_params_id;
|
||||
param_ranges = results.param_ranges;
|
||||
CARBON_CHECK(
|
||||
context.full_pattern_stack().GetRawDefaultValues().size() ==
|
||||
context.full_pattern_stack().GetConvertedDefaultValues().size());
|
||||
call_param_default_values_id = context.inst_blocks().Add(
|
||||
context.full_pattern_stack().GetConvertedDefaultValues());
|
||||
unspecified_values_block_id = context.inst_blocks().Add(
|
||||
context.full_pattern_stack().GetUnspecifiedDefaultValues());
|
||||
pattern_block_id = context.pattern_block_stack().Pop();
|
||||
context.full_pattern_stack().PopFullPattern();
|
||||
}
|
||||
@@ -69,21 +66,19 @@ auto PopNameComponent(Context& context, SemIR::InstId return_pattern_id)
|
||||
auto [name_loc_id, name_id] =
|
||||
context.node_stack().PopWithNodeId<Parse::NodeCategory::NonExprName>();
|
||||
|
||||
return {
|
||||
.name_loc_id = name_loc_id,
|
||||
.name_id = name_id,
|
||||
.first_param_node_id = first_param_node_id,
|
||||
.last_param_node_id = last_param_node_id,
|
||||
.implicit_params_loc_id = implicit_params_node_id,
|
||||
.implicit_param_patterns_id = *implicit_param_patterns_id,
|
||||
.params_loc_id = params_node_id,
|
||||
.param_patterns_id = *param_patterns_id,
|
||||
.call_param_patterns_id = call_param_patterns_id,
|
||||
.call_params_id = call_params_id,
|
||||
.call_param_default_values_id = call_param_default_values_id,
|
||||
.param_ranges = param_ranges,
|
||||
.pattern_block_id = pattern_block_id,
|
||||
};
|
||||
return {.name_loc_id = name_loc_id,
|
||||
.name_id = name_id,
|
||||
.first_param_node_id = first_param_node_id,
|
||||
.last_param_node_id = last_param_node_id,
|
||||
.implicit_params_loc_id = implicit_params_node_id,
|
||||
.implicit_param_patterns_id = *implicit_param_patterns_id,
|
||||
.params_loc_id = params_node_id,
|
||||
.param_patterns_id = *param_patterns_id,
|
||||
.call_param_patterns_id = call_param_patterns_id,
|
||||
.call_params_id = call_params_id,
|
||||
.param_ranges = param_ranges,
|
||||
.pattern_block_id = pattern_block_id,
|
||||
.unspecified_values_block_id = unspecified_values_block_id};
|
||||
}
|
||||
|
||||
// Pop the name of a declaration from the node stack, and diagnose if it has
|
||||
|
||||
Reference in New Issue
Block a user