(&mut self, ctx: LoweringCtx, end_ip: usize)
| 728 | } |
| 729 | |
| 730 | fn patch_end_jumps(&mut self, ctx: LoweringCtx, end_ip: usize) { |
| 731 | match ctx.kind { |
| 732 | BlockKind::Block | BlockKind::Loop => { |
| 733 | let target = if matches!(ctx.kind, BlockKind::Loop) { ctx.start_ip } else { end_ip }; |
| 734 | for jump_ip in ctx.branch_jumps { |
| 735 | self.patch_jump(jump_ip, target); |
| 736 | } |
| 737 | } |
| 738 | BlockKind::If => { |
| 739 | if let Some((&cond_jump_ip, branch_jumps)) = ctx.branch_jumps.split_first() { |
| 740 | if !ctx.has_else { |
| 741 | self.patch_jump_if_zero(cond_jump_ip, end_ip); |
| 742 | } |
| 743 | for &jump_ip in branch_jumps { |
| 744 | self.patch_jump(jump_ip, end_ip); |
| 745 | } |
| 746 | } |
| 747 | } |
| 748 | } |
| 749 | } |
| 750 | } |
no test coverage detected