mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 14:21:09 +01:00
Move 'export name' out of the import section. (#3950)
This implements recent updates to #3938
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "toolchain/check/context.h"
|
||||
#include "toolchain/check/decl_name_stack.h"
|
||||
#include "toolchain/check/modifiers.h"
|
||||
#include "toolchain/parse/typed_nodes.h"
|
||||
#include "toolchain/sem_ir/ids.h"
|
||||
#include "toolchain/sem_ir/typed_insts.h"
|
||||
@@ -12,6 +13,7 @@ namespace Carbon::Check {
|
||||
|
||||
auto HandleExportIntroducer(Context& context,
|
||||
Parse::ExportIntroducerId /*node_id*/) -> bool {
|
||||
context.decl_state_stack().Push(DeclState::Export);
|
||||
// TODO: Probably need to update DeclNameStack to restrict to only namespaces.
|
||||
context.decl_name_stack().PushScopeAndStartName();
|
||||
return true;
|
||||
@@ -22,6 +24,10 @@ auto HandleExportDirective(Context& context, Parse::ExportDirectiveId node_id)
|
||||
auto name_context = context.decl_name_stack().FinishName();
|
||||
context.decl_name_stack().PopScope();
|
||||
|
||||
LimitModifiersOnDecl(context, KeywordModifierSet::None,
|
||||
Lex::TokenKind::Export);
|
||||
context.decl_state_stack().Pop(DeclState::Export);
|
||||
|
||||
if (name_context.state == DeclNameStack::NameContext::State::Error) {
|
||||
// Should already be diagnosed.
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user