mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 08:44:41 +01:00
Generate parameter pattern-match IR from pattern IR (#4388)
Also propagate the pattern IR along with the pattern-match IR, and use it where appropriate. Strictly speaking, some parts of the pattern-match IR are allocated eagerly, while traversing the pattern's parse tree, but they still aren't actually emitted until we traverse the associated pattern insts. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
4a73b36688
commit
9d942f4633
@@ -60,8 +60,9 @@ static auto BuildInterfaceDecl(Context& context,
|
||||
SemIR::Interface interface_info = {name_context.MakeEntityWithParamsBase(
|
||||
name, interface_decl_id, /*is_extern=*/false,
|
||||
SemIR::LibraryNameId::Invalid)};
|
||||
RequireGenericParamsOnType(context, interface_info.implicit_param_refs_id);
|
||||
RequireGenericParamsOnType(context, interface_info.param_refs_id);
|
||||
RequireGenericParamsOnType(context,
|
||||
interface_info.implicit_param_patterns_id);
|
||||
RequireGenericParamsOnType(context, interface_info.param_patterns_id);
|
||||
|
||||
// Check whether this is a redeclaration.
|
||||
auto existing_id = context.decl_name_stack().LookupOrAddName(
|
||||
@@ -74,8 +75,9 @@ static auto BuildInterfaceDecl(Context& context,
|
||||
if (CheckRedeclParamsMatch(
|
||||
context,
|
||||
DeclParams(interface_decl_id, name.first_param_node_id,
|
||||
name.last_param_node_id, name.implicit_params_id,
|
||||
name.params_id),
|
||||
name.last_param_node_id,
|
||||
name.implicit_param_patterns_id,
|
||||
name.param_patterns_id),
|
||||
DeclParams(existing_interface))) {
|
||||
// TODO: This should be refactored a little, particularly for
|
||||
// prev_import_ir_id. See similar logic for classes and functions, which
|
||||
|
||||
Reference in New Issue
Block a user