(&mut self, pc: &mut PatternContext, op: JumpOp)
| 5917 | } |
| 5918 | |
| 5919 | fn jump_to_fail_pop(&mut self, pc: &mut PatternContext, op: JumpOp) -> CompileResult<()> { |
| 5920 | // Compute the total number of items to pop: |
| 5921 | // items on top plus the captured objects. |
| 5922 | let pops = pc.on_top + pc.stores.len(); |
| 5923 | // Ensure that the fail_pop vector has at least `pops + 1` elements. |
| 5924 | self.ensure_fail_pop(pc, pops)?; |
| 5925 | // Emit a jump using the jump target stored at index `pops`. |
| 5926 | match op { |
| 5927 | JumpOp::Jump => { |
| 5928 | emit!( |
| 5929 | self, |
| 5930 | PseudoInstruction::Jump { |
| 5931 | delta: pc.fail_pop[pops] |
| 5932 | } |
| 5933 | ); |
| 5934 | } |
| 5935 | JumpOp::PopJumpIfFalse => { |
| 5936 | emit!( |
| 5937 | self, |
| 5938 | Instruction::PopJumpIfFalse { |
| 5939 | delta: pc.fail_pop[pops] |
| 5940 | } |
| 5941 | ); |
| 5942 | } |
| 5943 | } |
| 5944 | Ok(()) |
| 5945 | } |
| 5946 | |
| 5947 | /// Emits the necessary POP instructions for all failure targets in the pattern context, |
| 5948 | /// then resets the fail_pop vector. |
no test coverage detected