| ... | @@ -3953,18 +3953,21 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3953,18 +3953,21 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void { |
| 3953 | } | 3953 | } |
| 3954 | | 3954 | |
| 3955 | if (switch_br.data.else_body_len > 0) { | 3955 | if (switch_br.data.else_body_len > 0) { |
| 3956 | return self.fail("TODO handle else branch in switch", .{}); | 3956 | const else_body = self.air.extra[extra_index..][0..switch_br.data.else_body_len]; |
| 3957 | } | 3957 | try self.branch_stack.append(.{}); |
| | 3958 | defer self.branch_stack.pop().deinit(self.gpa); |
| 3958 | | 3959 | |
| 3959 | // const else_body = self.air.extra[extra_index..][0..switch_br.data.else_body_len]; | 3960 | const else_deaths = liveness.deaths.len - 1; |
| 3960 | // const else_branch = self.branch_stack.addOneAssumeCapacity(); | 3961 | try self.ensureProcessDeathCapacity(liveness.deaths[else_deaths].len); |
| 3961 | // else_branch.* = .{}; | 3962 | for (liveness.deaths[else_deaths]) |operand| { |
| | 3963 | self.processDeath(operand); |
| | 3964 | } |
| 3962 | | 3965 | |
| 3963 | // if (else_body.len != 0) { | 3966 | try self.genBody(else_body); |
| 3964 | // try self.genBody(else_body); | | |
| 3965 | // } else { | | |
| 3966 | | 3967 | |
| 3967 | // } | 3968 | // TODO consolidate returned MCValues between prongs and else branch like we do |
| | 3969 | // in airCondBr. |
| | 3970 | } |
| 3968 | | 3971 | |
| 3969 | return self.finishAir(inst, .unreach, .{ pl_op.operand, .none, .none }); | 3972 | return self.finishAir(inst, .unreach, .{ pl_op.operand, .none, .none }); |
| 3970 | } | 3973 | } |