mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Implement a list of exported names for imports. (#3552)
This adds a block for exported InstIds, rather than scanning the package scope. This working down a path discussed last month, which we'll need to add enclosing namespaces to the Inst in order to complete import of something like `namespace NS; var NS.a;` Exports could've been a separate `vector<InstId>` on `SemIR::File`, but using an entry in `inst_blocks` felt more consistent.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "toolchain/check/decl_name_stack.h"
|
||||
|
||||
#include "toolchain/check/context.h"
|
||||
#include "toolchain/sem_ir/ids.h"
|
||||
|
||||
namespace Carbon::Check {
|
||||
|
||||
@@ -83,6 +84,7 @@ auto DeclNameStack::LookupOrAddName(NameContext name_context,
|
||||
QualifiedDeclOutsideScopeEntity);
|
||||
}
|
||||
}
|
||||
context_->AddExport(target_id);
|
||||
auto [_, success] = name_scope.names.insert(
|
||||
{name_context.unresolved_name_id, target_id});
|
||||
CARBON_CHECK(success)
|
||||
|
||||
Reference in New Issue
Block a user