mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 06:44:46 +01:00
Replace form insts with actions (#7100)
See [here](https://docs.google.com/document/d/1rWcueFwIfZox6GKVGxiUG4cBzjrZ6djXiIDGyJDtrE4/edit?tab=t.0) for the design doc. This also removes the default value of the `result_type_inst_id` parameter of `HandleAction`, moves it before the action in the parameter list, and documents it. This solves two problems: - The default made it easy to forget, leading to unnecessary `TypeOfInst` instructions. - When it was present, putting it after the fairly "bulky" action argument tended to make the callsite harder to read.
This commit is contained in:
@@ -63,7 +63,6 @@ static auto CloneBindingPattern(Context& context, SemIR::InstId pattern_id,
|
||||
auto entity_name = context.entity_names().Get(pattern.entity_name_id);
|
||||
CARBON_CHECK((pattern.kind == SemIR::SymbolicBindingPattern::Kind) ==
|
||||
entity_name.bind_index().has_value());
|
||||
CARBON_CHECK(pattern.kind != SemIR::FormBindingPattern::Kind);
|
||||
// Get the transformed type of the binding.
|
||||
if (new_pattern_type_id == SemIR::ErrorInst::TypeId) {
|
||||
return SemIR::ErrorInst::InstId;
|
||||
@@ -80,8 +79,8 @@ static auto CloneBindingPattern(Context& context, SemIR::InstId pattern_id,
|
||||
if (pattern.kind == SemIR::WrapperBindingPattern::Kind) {
|
||||
auto subpattern = context.insts().GetAs<SemIR::AnyLeafParamPattern>(
|
||||
pattern.subpattern_id);
|
||||
if (subpattern.kind == SemIR::FormParamPattern::Kind) {
|
||||
context.TODO(pattern_id, "Support for cloning form bindings");
|
||||
if (subpattern.kind == SemIR::FormParamPatternAction::Kind) {
|
||||
context.TODO(pattern_id, "Support for cloning generic form bindings");
|
||||
return SemIR::ErrorInst::InstId;
|
||||
}
|
||||
pattern.subpattern_id = RebuildPatternInst<SemIR::AnyLeafParamPattern>(
|
||||
|
||||
Reference in New Issue
Block a user