Move common entity fields to a 'base' struct. (#4161)

I'd considered moving DeclParams uses over, but when handling qualified
names, there's a parse node instead of an instruction. I did try to
unify a couple other uses though, including adding MergeDefinition. I
expect `interface` will use a little more once it's more completely
implemented, but maybe I'm wrong about that.
This commit is contained in:
Jon Ross-Perkins
2024-07-24 23:26:00 +00:00
committed by GitHub
parent a0973f4f47
commit bf89652a4d
21 changed files with 331 additions and 308 deletions
+4
View File
@@ -380,6 +380,9 @@ auto DeclNameStack::ResolveAsScope(const NameContext& name_context,
name.params_id);
// Find the scope corresponding to the resolved instruction.
// TODO: When diagnosing qualifiers on names, print a diagnostic that talks
// about qualifiers instead of redeclarations. Maybe also rename
// CheckRedeclParamsMatch.
CARBON_KIND_SWITCH(context_->insts().Get(name_context.resolved_inst_id)) {
case CARBON_KIND(SemIR::ClassDecl class_decl): {
const auto& class_info = context_->classes().Get(class_decl.class_id);
@@ -414,6 +417,7 @@ auto DeclNameStack::ResolveAsScope(const NameContext& name_context,
case CARBON_KIND(SemIR::Namespace resolved_inst): {
auto scope_id = resolved_inst.name_scope_id;
auto& scope = context_->name_scopes().Get(scope_id);
// This is specifically for qualified name handling.
if (!CheckRedeclParamsMatch(
*context_, new_params,
DeclParams(name_context.resolved_inst_id, Parse::NodeId::Invalid,