mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 11:51:04 +01:00
Refactor AddBindingPattern into composable pieces (#6927)
This is part of some bigger changes in pattern matching, factored out because it causes some test churn. Assisted-by: Gemini 3.1 Pro via Antigravity
This commit is contained in:
@@ -180,10 +180,19 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
|
||||
auto make_binding_pattern = [&]() -> SemIR::InstId {
|
||||
// TODO: Eventually the name will need to support associations with other
|
||||
// scopes, but right now we don't support qualified names here.
|
||||
auto form_id = pattern_inst_kind == SemIR::FormBindingPattern::Kind
|
||||
? context.constant_values().Get(type_expr.inst_id)
|
||||
: SemIR::ConstantId::None;
|
||||
auto phase = BindingPhase::Runtime;
|
||||
if (pattern_inst_kind == SemIR::SymbolicBindingPattern::Kind) {
|
||||
phase = is_template ? BindingPhase::Template : BindingPhase::Symbolic;
|
||||
}
|
||||
auto binding = AddBindingPattern(
|
||||
context, name_node, name_id, type_expr.type_component_id,
|
||||
context.constant_values().Get(type_expr.inst_id), type_expr_region_id,
|
||||
pattern_inst_kind, is_template, is_unused);
|
||||
context, name_node, type_expr_region_id,
|
||||
{.kind = pattern_inst_kind,
|
||||
.type_id = GetPatternType(context, type_expr.type_component_id),
|
||||
.entity_name_id = AddBindingEntityName(context, name_id, form_id,
|
||||
is_unused, phase)});
|
||||
|
||||
// TODO: If `is_generic`, then `binding.bind_id is a SymbolicBinding. Subst
|
||||
// the `.Self` of type `type` in the `cast_type_id` type (a `FacetType`)
|
||||
|
||||
Reference in New Issue
Block a user