(blocks: &mut [Block], predecessors: &[u32])
| 2788 | } |
| 2789 | |
| 2790 | fn propagate_line_numbers(blocks: &mut [Block], predecessors: &[u32]) { |
| 2791 | let mut current = BlockIdx(0); |
| 2792 | while current != BlockIdx::NULL { |
| 2793 | let last = blocks[current.idx()].instructions.last().copied(); |
| 2794 | if let Some(last) = last { |
| 2795 | let (next_block, has_fallthrough) = { |
| 2796 | let block = &blocks[current.idx()]; |
| 2797 | (block.next, block_has_fallthrough(block)) |
| 2798 | }; |
| 2799 | |
| 2800 | { |
| 2801 | let block = &mut blocks[current.idx()]; |
| 2802 | let mut prev_location = None; |
| 2803 | for instr in &mut block.instructions { |
| 2804 | if let Some((location, end_location)) = prev_location { |
| 2805 | maybe_propagate_location(instr, location, end_location); |
| 2806 | } |
| 2807 | prev_location = Some((instr.location, instr.end_location)); |
| 2808 | } |
| 2809 | } |
| 2810 | |
| 2811 | if has_fallthrough { |
| 2812 | let target = next_nonempty_block(blocks, next_block); |
| 2813 | if target != BlockIdx::NULL && predecessors[target.idx()] == 1 { |
| 2814 | propagate_locations_in_block( |
| 2815 | &mut blocks[target.idx()], |
| 2816 | last.location, |
| 2817 | last.end_location, |
| 2818 | ); |
| 2819 | } |
| 2820 | } |
| 2821 | |
| 2822 | if is_jump_instruction(&last) { |
| 2823 | let target = next_nonempty_block(blocks, last.target); |
| 2824 | if target != BlockIdx::NULL && predecessors[target.idx()] == 1 { |
| 2825 | propagate_locations_in_block( |
| 2826 | &mut blocks[target.idx()], |
| 2827 | last.location, |
| 2828 | last.end_location, |
| 2829 | ); |
| 2830 | } |
| 2831 | } |
| 2832 | } |
| 2833 | current = blocks[current.idx()].next; |
| 2834 | } |
| 2835 | } |
| 2836 | |
| 2837 | fn resolve_line_numbers(blocks: &mut Vec<Block>) { |
| 2838 | let mut predecessors = compute_predecessors(blocks); |
no test coverage detected