(source: &str, fragment: &str)
| 26 | } |
| 27 | } |
| 28 | |
| 29 | fn has_instruction<F>(source: &str, pred: F) -> bool |
| 30 | where |
| 31 | F: Fn(&IrInstruction) -> bool, |
| 32 | { |
| 33 | let result = compile_ok(source); |
| 34 | result |
| 35 | .ir_program |
| 36 | .functions |
| 37 | .iter() |
| 38 | .flat_map(|f| f.blocks.iter()) |
| 39 | .flat_map(|b| b.instructions.iter()) |
| 40 | .any(pred) |
| 41 | } |
| 42 | |
| 43 | fn count_instructions<F>(source: &str, pred: F) -> usize |