mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 16:21:04 +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:
@@ -262,8 +262,9 @@ auto HandleFunctionDefinitionStart(Context& context,
|
||||
});
|
||||
|
||||
if (auto fn_param = param.TryAs<SemIR::BindName>()) {
|
||||
context.AddNameToLookup(fn_param->parse_node, fn_param->name_id,
|
||||
param_id);
|
||||
context.AddNameToLookup(
|
||||
fn_param->parse_node,
|
||||
context.bind_names().Get(fn_param->bind_name_id).name_id, param_id);
|
||||
} else {
|
||||
CARBON_FATAL() << "Unexpected kind of parameter in function definition "
|
||||
<< param;
|
||||
|
||||
Reference in New Issue
Block a user