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:
Jon Ross-Perkins
2024-01-02 22:17:27 +00:00
committed by GitHub
parent 13b8c33c79
commit b6ffe0197b
13 changed files with 118 additions and 51 deletions
+2
View File
@@ -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)