mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 06:31:03 +01:00
Clean up some uses of the node stack. (#3512)
Also minor cleanups for the stack itself.
This commit is contained in:
@@ -27,13 +27,10 @@ auto DeclNameStack::PushScopeAndStartName() -> void {
|
||||
auto DeclNameStack::FinishName() -> NameContext {
|
||||
CARBON_CHECK(decl_name_stack_.back().state != NameContext::State::Finished)
|
||||
<< "Finished name twice";
|
||||
if (context_->parse_tree().node_kind(
|
||||
context_->node_stack().PeekParseNode()) ==
|
||||
Parse::NodeKind::QualifiedDecl) {
|
||||
if (context_->node_stack()
|
||||
.PopAndDiscardSoloParseNodeIf<Parse::NodeKind::QualifiedDecl>()) {
|
||||
// Any parts from a QualifiedDecl will already have been processed
|
||||
// into the name.
|
||||
context_->node_stack()
|
||||
.PopAndDiscardSoloParseNode<Parse::NodeKind::QualifiedDecl>();
|
||||
} else {
|
||||
// The name had no qualifiers, so we need to process the node now.
|
||||
auto [parse_node, name_id] = context_->node_stack().PopNameWithParseNode();
|
||||
|
||||
Reference in New Issue
Block a user