Handles the else branch if the current control stack frame is [`ControlStackFrame::If`].
(
&mut self,
masm: &mut M,
context: &mut CodeGenContext<Emission>,
)
| 484 | /// Handles the else branch if the current control stack frame is |
| 485 | /// [`ControlStackFrame::If`]. |
| 486 | pub fn emit_else<M: MacroAssembler>( |
| 487 | &mut self, |
| 488 | masm: &mut M, |
| 489 | context: &mut CodeGenContext<Emission>, |
| 490 | ) -> Result<()> { |
| 491 | ensure!(self.is_if(), CodeGenError::if_control_frame_expected()); |
| 492 | let state = self.stack_state(); |
| 493 | |
| 494 | ensure!( |
| 495 | state.target_len == context.stack.len(), |
| 496 | CodeGenError::control_frame_state_mismatch() |
| 497 | ); |
| 498 | self.pop_abi_results(context, masm, |results, _, _| { |
| 499 | Ok(results.ret_area().copied()) |
| 500 | })?; |
| 501 | masm.jmp(*self.exit_label().unwrap())?; |
| 502 | self.bind_else(masm, context)?; |
| 503 | Ok(()) |
| 504 | } |
| 505 | |
| 506 | /// Binds the else branch label and converts `self` to |
| 507 | /// [`ControlStackFrame::Else`]. |
no test coverage detected