mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Refactor BindName to support tracking the enclosing scope. (#3566)
This is a step towards adding enclosing scopes for imports. It creates an indirection for all bind names. We discussed specializing for bindings that are in function scope (i.e., not a useful enclosing scope for imports or diagnostics). However, the thought is to go ahead with this singular approach for now, and only change structure if it's a performance issues so that we have incrementally fewer instructions to handle.
This commit is contained in:
@@ -57,10 +57,10 @@ auto HandleVariableDecl(Context& context, Parse::VariableDeclId parse_node)
|
||||
if (auto bind_name = context.insts().Get(value_id).TryAs<SemIR::BindName>()) {
|
||||
// Form a corresponding name in the current context, and bind the name to
|
||||
// the variable.
|
||||
context.decl_name_stack().AddNameToLookup(
|
||||
context.decl_name_stack().MakeUnqualifiedName(bind_name->parse_node,
|
||||
bind_name->name_id),
|
||||
value_id);
|
||||
auto name_context = context.decl_name_stack().MakeUnqualifiedName(
|
||||
bind_name->parse_node,
|
||||
context.bind_names().Get(bind_name->bind_name_id).name_id);
|
||||
context.decl_name_stack().AddNameToLookup(name_context, value_id);
|
||||
value_id = bind_name->value_id;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user