mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-18 17:20:30 +00:00
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:
1 parent
da34f61ef9
commit
5ab26072fd
4 files changed
+57
-37
No files matched your search
@@ -47,6 +47,15 @@ auto DeclNameStack::FinishName() -> NameContext {
|
||||
return result;
|
||||
}
|
||||
|
||||
auto DeclNameStack::FinishImplName() -> NameContext {
|
||||
CARBON_CHECK(decl_name_stack_.back().state == NameContext::State::Empty)
|
||||
<< "Impl has a name";
|
||||
|
||||
NameContext result = decl_name_stack_.back();
|
||||
decl_name_stack_.back().state = NameContext::State::Finished;
|
||||
return result;
|
||||
}
|
||||
|
||||
auto DeclNameStack::PopScope() -> void {
|
||||
CARBON_CHECK(decl_name_stack_.back().state == NameContext::State::Finished)
|
||||
<< "Missing call to FinishName before PopScope";
|
||||
|
||||
Reference in new issue
Block a user