Initial 'export name' handling. (#3949)

This adds a `BindExport` instruction in order to better track the
location of the `export` itself, but a `bind_name_id` is also added to
`ImportRef` so that we know quickly where to put it in name lookup.

Merging identical names is a TODO. I haven't quite decided how best to
achieve that, because I do think the BindExport should be what's
actually added to name lookup.

Also, I will probably add a mode to DeclNameStack that blocks
non-namespace scopes. This seems to already be an error, but the wrong
one (maybe due to lack of support for cross-file decl/def support).
This commit is contained in:
Jon Ross-Perkins
2024-05-17 18:05:52 +00:00
committed by GitHub
parent 122a361317
commit 40b2217421
22 changed files with 2135 additions and 234 deletions
+2 -2
View File
@@ -106,8 +106,8 @@ static auto BuildInterfaceWitness(
CARBON_FATAL() << "Unexpected type: " << type_inst;
}
auto& fn = context.functions().Get(fn_type->function_id);
auto impl_decl_id =
context.LookupNameInExactScope(decl_id, fn.name_id, impl_scope);
auto impl_decl_id = context.LookupNameInExactScope(
decl_id, fn.name_id, impl.scope_id, impl_scope);
if (impl_decl_id.is_valid()) {
used_decl_ids.push_back(impl_decl_id);
table.push_back(CheckAssociatedFunctionImplementation(