mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 15:51:07 +01:00
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:
@@ -5,6 +5,7 @@
|
||||
#include "toolchain/check/context.h"
|
||||
#include "toolchain/check/interface.h"
|
||||
#include "toolchain/check/modifiers.h"
|
||||
#include "toolchain/check/name_component.h"
|
||||
#include "toolchain/sem_ir/typed_insts.h"
|
||||
|
||||
namespace Carbon::Check {
|
||||
@@ -25,14 +26,12 @@ auto HandleInterfaceIntroducer(Context& context,
|
||||
static auto BuildInterfaceDecl(Context& context,
|
||||
Parse::AnyInterfaceDeclId node_id)
|
||||
-> std::tuple<SemIR::InterfaceId, SemIR::InstId> {
|
||||
if (context.node_stack().PopIf<Parse::NodeKind::TuplePattern>()) {
|
||||
context.TODO(node_id, "generic interface");
|
||||
}
|
||||
if (context.node_stack().PopIf<Parse::NodeKind::ImplicitParamList>()) {
|
||||
auto name = PopNameComponent(context);
|
||||
if (name.params_id.is_valid() || name.implicit_params_id.is_valid()) {
|
||||
context.TODO(node_id, "generic interface");
|
||||
}
|
||||
|
||||
auto name_context = context.decl_name_stack().FinishName();
|
||||
auto name_context = context.decl_name_stack().FinishName(name);
|
||||
context.node_stack()
|
||||
.PopAndDiscardSoloNodeId<Parse::NodeKind::InterfaceIntroducer>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user