mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 12:21:07 +01: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:
@@ -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