Factor out pushing / popping of names plus parameters. (#4005)

Previously we did some of this in decl_name_stack and some of it in the
callers of decl_name_stack. Factor out a single place to pop a name and
its optional following parameters.

Part of making this behavior consistent is that we now track whether an
implicit parameter list was present or absent rather than mapping an
absent list to `InstBlockId::Empty`. This improves our redeclaration
checking and the precision of some diagnostics.
This commit is contained in:
Richard Smith
2024-05-30 16:05:35 +00:00
committed by GitHub
parent cda5f66d22
commit 28cefe98df
24 changed files with 249 additions and 138 deletions
+3 -1
View File
@@ -5,6 +5,7 @@
#include "toolchain/check/context.h"
#include "toolchain/check/decl_name_stack.h"
#include "toolchain/check/modifiers.h"
#include "toolchain/check/name_component.h"
#include "toolchain/parse/typed_nodes.h"
#include "toolchain/sem_ir/ids.h"
#include "toolchain/sem_ir/typed_insts.h"
@@ -20,7 +21,8 @@ auto HandleExportIntroducer(Context& context,
}
auto HandleExportDecl(Context& context, Parse::ExportDeclId node_id) -> bool {
auto name_context = context.decl_name_stack().FinishName();
auto name_context = context.decl_name_stack().FinishName(
PopNameComponentWithoutParams(context, Lex::TokenKind::Export));
context.decl_name_stack().PopScope();
LimitModifiersOnDecl(context, KeywordModifierSet::None,