(
&mut self,
hole: Hole,
goto1: Option<InstPtr>,
goto2: Option<InstPtr>,
)
| 655 | } |
| 656 | |
| 657 | fn fill_split( |
| 658 | &mut self, |
| 659 | hole: Hole, |
| 660 | goto1: Option<InstPtr>, |
| 661 | goto2: Option<InstPtr>, |
| 662 | ) -> Hole { |
| 663 | match hole { |
| 664 | Hole::None => Hole::None, |
| 665 | Hole::One(pc) => { |
| 666 | match (goto1, goto2) { |
| 667 | (Some(goto1), Some(goto2)) => { |
| 668 | self.insts[pc].fill_split(goto1, goto2); |
| 669 | Hole::None |
| 670 | } |
| 671 | (Some(goto1), None) => { |
| 672 | self.insts[pc].half_fill_split_goto1(goto1); |
| 673 | Hole::One(pc) |
| 674 | } |
| 675 | (None, Some(goto2)) => { |
| 676 | self.insts[pc].half_fill_split_goto2(goto2); |
| 677 | Hole::One(pc) |
| 678 | } |
| 679 | (None, None) => unreachable!("at least one of the split \ |
| 680 | holes must be filled"), |
| 681 | } |
| 682 | } |
| 683 | Hole::Many(holes) => { |
| 684 | let mut new_holes = vec![]; |
| 685 | for hole in holes { |
| 686 | new_holes.push(self.fill_split(hole, goto1, goto2)); |
| 687 | } |
| 688 | if new_holes.is_empty() { |
| 689 | Hole::None |
| 690 | } else if new_holes.len() == 1 { |
| 691 | new_holes.pop().unwrap() |
| 692 | } else { |
| 693 | Hole::Many(new_holes) |
| 694 | } |
| 695 | } |
| 696 | } |
| 697 | } |
| 698 | |
| 699 | fn push_compiled(&mut self, inst: Inst) { |
| 700 | self.insts.push(MaybeInst::Compiled(inst)); |
no test coverage detected