mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 06:54:44 +01:00
Factor out pushing / popping of names plus parameters. (#4005)
Previously we did some of this in decl_name_stack and some of it in the callers of decl_name_stack. Factor out a single place to pop a name and its optional following parameters. Part of making this behavior consistent is that we now track whether an implicit parameter list was present or absent rather than mapping an absent list to `InstBlockId::Empty`. This improves our redeclaration checking and the precision of some diagnostics.
This commit is contained in:
@@ -139,8 +139,9 @@ auto FileContext::BuildFunctionDecl(SemIR::FunctionId function_id)
|
||||
|
||||
const bool has_return_slot = function.has_return_slot();
|
||||
auto implicit_param_refs =
|
||||
sem_ir().inst_blocks().Get(function.implicit_param_refs_id);
|
||||
auto param_refs = sem_ir().inst_blocks().Get(function.param_refs_id);
|
||||
sem_ir().inst_blocks().GetOrEmpty(function.implicit_param_refs_id);
|
||||
// TODO: Include parameters corresponding to positional parameters.
|
||||
auto param_refs = sem_ir().inst_blocks().GetOrEmpty(function.param_refs_id);
|
||||
|
||||
SemIR::InitRepr return_rep =
|
||||
function.return_type_id.is_valid()
|
||||
@@ -245,8 +246,8 @@ auto FileContext::BuildFunctionDefinition(SemIR::FunctionId function_id)
|
||||
// function parameters that was already computed in BuildFunctionDecl.
|
||||
// We should only do that once.
|
||||
auto implicit_param_refs =
|
||||
sem_ir().inst_blocks().Get(function.implicit_param_refs_id);
|
||||
auto param_refs = sem_ir().inst_blocks().Get(function.param_refs_id);
|
||||
sem_ir().inst_blocks().GetOrEmpty(function.implicit_param_refs_id);
|
||||
auto param_refs = sem_ir().inst_blocks().GetOrEmpty(function.param_refs_id);
|
||||
int param_index = 0;
|
||||
if (has_return_slot) {
|
||||
function_lowering.SetLocal(function.return_storage_id,
|
||||
|
||||
Reference in New Issue
Block a user