mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Remove InitForm::index (#6817)
This ensures that equal forms always have equal representations (because the index depends on how the form is used, not on the value of the form itself). As a byproduct, also remove `NextCallParamIndex`. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nicholas Bishop <nicholasbishop@google.com> Co-authored-by: Jon Ross-Perkins <jperkins@google.com> Co-authored-by: Dana Jansens <danakj@orodu.net> Co-authored-by: Boaz Brickner <brickner@google.com> Co-authored-by: Richard Smith <richard@metafoo.co.uk> Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com> Co-authored-by: MK4070 <60286678+MK4070@users.noreply.github.com> Co-authored-by: Christopher Di Bella <cjdb@google.com>
This commit is contained in:
co-authored by
dependabot[bot]
Nicholas Bishop
Jon Ross-Perkins
Dana Jansens
Boaz Brickner
Richard Smith
Carbon Infra Bot
MK4070
Christopher Di Bella
parent
2327b62b5f
commit
21291b4cc3
@@ -72,11 +72,10 @@ auto IsValidBuiltinDeclaration(Context& context,
|
||||
}
|
||||
|
||||
// Find the list of call parameters other than the implicit return slots.
|
||||
auto call_params = context.inst_blocks()
|
||||
.Get(function.call_params_id)
|
||||
.drop_back(context.inst_blocks()
|
||||
.GetOrEmpty(function.return_patterns_id)
|
||||
.size());
|
||||
auto call_params =
|
||||
context.inst_blocks()
|
||||
.Get(function.call_params_id)
|
||||
.take_front(function.call_param_ranges.explicit_end().index);
|
||||
|
||||
// Get the return type. This is `()` if none was specified.
|
||||
auto return_type_id = function.GetDeclaredReturnType(context.sem_ir());
|
||||
@@ -97,6 +96,8 @@ struct FunctionSignatureInsts {
|
||||
SemIR::InstBlockId param_patterns_id = SemIR::InstBlockId::None;
|
||||
SemIR::InstBlockId call_param_patterns_id = SemIR::InstBlockId::None;
|
||||
SemIR::InstBlockId call_params_id = SemIR::InstBlockId::None;
|
||||
SemIR::Function::CallParamIndexRanges call_param_ranges =
|
||||
SemIR::Function::CallParamIndexRanges::Empty;
|
||||
SemIR::TypeInstId return_type_inst_id = SemIR::TypeInstId::None;
|
||||
SemIR::InstId return_form_inst_id = SemIR::InstId::None;
|
||||
SemIR::InstBlockId return_patterns_id = SemIR::InstBlockId::None;
|
||||
@@ -160,11 +161,12 @@ static auto MakeFunctionSignature(Context& context, SemIR::LocId loc_id,
|
||||
insts.return_patterns_id = AddReturnPatterns(context, loc_id, return_form);
|
||||
}
|
||||
|
||||
auto [call_param_patterns_id, call_params_id] =
|
||||
auto match_results =
|
||||
CalleePatternMatch(context, insts.implicit_param_patterns_id,
|
||||
insts.param_patterns_id, insts.return_patterns_id);
|
||||
insts.call_param_patterns_id = call_param_patterns_id;
|
||||
insts.call_params_id = call_params_id;
|
||||
insts.call_param_patterns_id = match_results.call_param_patterns_id;
|
||||
insts.call_params_id = match_results.call_params_id;
|
||||
insts.call_param_ranges = match_results.param_ranges;
|
||||
|
||||
context.full_pattern_stack().PopFullPattern();
|
||||
auto [pattern_block_id, decl_block_id] =
|
||||
@@ -203,6 +205,7 @@ auto MakeGeneratedFunctionDecl(Context& context, SemIR::LocId loc_id,
|
||||
{
|
||||
.call_param_patterns_id = insts.call_param_patterns_id,
|
||||
.call_params_id = insts.call_params_id,
|
||||
.call_param_ranges = insts.call_param_ranges,
|
||||
.return_type_inst_id = insts.return_type_inst_id,
|
||||
.return_form_inst_id = insts.return_form_inst_id,
|
||||
.return_patterns_id = insts.return_patterns_id,
|
||||
|
||||
Reference in New Issue
Block a user