mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 11:41:06 +01:00
Push a decl name scope before calling CalleePatternMatch() (#5771)
Otherwise the return values of different functions collide. Part of #5063.
This commit is contained in:
@@ -697,10 +697,12 @@ static auto CreateFunctionParamsInsts(Context& context, SemIR::LocId loc_id,
|
||||
if (SemIR::ErrorInst::InstId == return_slot_pattern_id) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// TODO: Add support for implicit parameters.
|
||||
auto call_params_id = CalleePatternMatch(
|
||||
context, /*implicit_param_patterns_id=*/SemIR::InstBlockId::None,
|
||||
param_patterns_id, return_slot_pattern_id);
|
||||
|
||||
return {{.param_patterns_id = param_patterns_id,
|
||||
.return_slot_pattern_id = return_slot_pattern_id,
|
||||
.call_params_id = call_params_id}};
|
||||
@@ -726,6 +728,7 @@ static auto ImportFunctionDecl(Context& context, SemIR::LocId loc_id,
|
||||
return SemIR::ErrorInst::InstId;
|
||||
}
|
||||
|
||||
context.scope_stack().PushForDeclName();
|
||||
context.inst_block_stack().Push();
|
||||
context.pattern_block_stack().Push();
|
||||
|
||||
@@ -734,6 +737,7 @@ static auto ImportFunctionDecl(Context& context, SemIR::LocId loc_id,
|
||||
|
||||
auto pattern_block_id = context.pattern_block_stack().Pop();
|
||||
auto decl_block_id = context.inst_block_stack().Pop();
|
||||
context.scope_stack().Pop();
|
||||
|
||||
if (!function_params_insts.has_value()) {
|
||||
return SemIR::ErrorInst::InstId;
|
||||
|
||||
Reference in New Issue
Block a user