Use the DeclNameStack for impl declarations. (#3691)

They don't have names, but using the DeclNameStack anyway keeps our
behavior more consistent, and keeps track of the enclosing name scope
and the prior state of the scope stack for us.

Depends on #3683.
This commit is contained in:
Richard Smith authored and GitHub committed 2024-02-06 22:28:31 +00:00
1 parent da34f61ef9
commit 5ab26072fd
4 files changed
+57 -37

No files matched your search

+2 -3
View File
@@ -356,7 +356,7 @@ class NodeStack {
// that the parse node should not appear in the node stack at all.
using Id = IdUnion<SemIR::InstId, SemIR::InstBlockId, SemIR::FunctionId,
SemIR::ClassId, SemIR::InterfaceId, SemIR::ImplId,
SemIR::NameId, SemIR::NameScopeId, SemIR::TypeId>;
SemIR::NameId, SemIR::TypeId>;
// An entry in stack_.
struct Entry {
@@ -452,8 +452,6 @@ class NodeStack {
return Id::KindFor<SemIR::ImplId>();
case Parse::NodeKind::SelfValueName:
return Id::KindFor<SemIR::NameId>();
case Parse::NodeKind::ImplIntroducer:
return Id::KindFor<SemIR::NameScopeId>();
case Parse::NodeKind::ArrayExprSemi:
case Parse::NodeKind::ClassIntroducer:
case Parse::NodeKind::CodeBlockStart:
@@ -461,6 +459,7 @@ class NodeStack {
case Parse::NodeKind::FunctionIntroducer:
case Parse::NodeKind::IfStatementElse:
case Parse::NodeKind::ImplicitParamListStart:
case Parse::NodeKind::ImplIntroducer:
case Parse::NodeKind::InterfaceIntroducer:
case Parse::NodeKind::LetIntroducer:
case Parse::NodeKind::QualifiedName: