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
+3
View File
@@ -1065,6 +1065,9 @@ auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst)
case CARBON_KIND(SemIR::BindAlias typed_inst): {
return context.constant_values().Get(typed_inst.value_id);
}
case CARBON_KIND(SemIR::BindExport typed_inst): {
return context.constant_values().Get(typed_inst.value_id);
}
case CARBON_KIND(SemIR::NameRef typed_inst): {
return context.constant_values().Get(typed_inst.value_id);
}