Handle semantic name lookup for function parameters. (#2839)

I'm adding a separate function for this instead of adding a bool to AddToNameLookup because this way I don't need to pass in a parse node.
This commit is contained in:
Jon Ross-Perkins
2023-05-23 10:47:27 -07:00
committed by GitHub
parent 98105a23b4
commit bd4e22001f
5 changed files with 54 additions and 30 deletions
@@ -58,6 +58,11 @@ auto SemanticsHandleFunctionDefinitionStart(SemanticsContext& context,
context.node_block_stack().Push();
context.PushScope();
for (auto ref_id : context.semantics().GetNodeBlock(param_refs_id)) {
auto ref = context.semantics().GetNode(ref_id);
auto [name_id, target_id] = ref.GetAsBindName();
context.AddNameToLookupIgnoreConflicts(name_id, target_id);
}
context.return_scope_stack().push_back(decl_id);
context.node_stack().Push(parse_node, decl_id);