Create a BindName for function parameters. (#3535)

The goal here is to make the representation more uniform so that we can
start adding different kinds of binding -- checked generic bindings and
template bindings -- across both function parameters and local `let`
declarations.

With this change, the entry in the parameter list for the function is
the name binding, not the Param itself, which has some ripple effects on
consumers of that list that want to access the parameter rather than the
binding. This is expected to change again when we start adding more of
the pattern matching SemIR, but this seems good enough for now.
This commit is contained in:
Richard Smith authored and GitHub committed 2023-12-22 00:12:16 +00:00
1 parent b659f2d9c0
commit fe24ebc021
9 files changed
+182 -142

No files matched your search

+1 -1
View File
@@ -258,7 +258,7 @@ auto HandleFunctionDefinitionStart(Context& context, Parse::NodeId parse_node)
context.sem_ir().StringifyType(param.type_id()));
});
if (auto fn_param = param.TryAs<SemIR::Param>()) {
if (auto fn_param = param.TryAs<SemIR::BindName>()) {
context.AddNameToLookup(fn_param->parse_node, fn_param->name_id,
param_id);
} else {