Add 'let' handling for ImportRefUsed. (#3700)

- File::StringifyTypeExpr now has a case that hits the ImportRefUsed
TODO, so implementing that. I think the `static` approach will be
helpful in ensuring there aren't access bugs, particularly when future
support is added.

- `let` wasn't adding to exports because it doesn't use
`decl_name_stack` the way `var` does. This now adds to exports, but we
might want to unify logic for issues such as this.

- BuildImportRefUsedValueRepr is now called for another inst kind, and
it seemed like calling back to BuildValueRepr was the best way to
resolve this. I don't *think* that's going to cause recursion.
This commit is contained in:
Jon Ross-Perkins
2024-02-13 00:53:13 +00:00
committed by GitHub
parent 99bc9734d9
commit f76bc733f4
9 changed files with 272 additions and 101 deletions
+3
View File
@@ -71,6 +71,9 @@ auto HandleLetDecl(Context& context, Parse::LetDeclId parse_node) -> bool {
// Add the name of the binding to the current scope.
auto name_id = context.bind_names().Get(bind_name.bind_name_id).name_id;
context.AddNameToLookup(name_id, pattern_id);
if (context.scope_stack().PeekNameScopeId() == SemIR::NameScopeId::Package) {
context.AddExport(pattern_id);
}
return true;
}