Asserts that `expr` in "LetRec-major" form. This means `expr` is either `LetRec`-free, or a `LetRec` whose values and body are `LetRec`-major.
(expr: &MirRelationExpr)
| 649 | /// |
| 650 | /// This means `expr` is either `LetRec`-free, or a `LetRec` whose values and body are `LetRec`-major. |
| 651 | pub(crate) fn assert_letrec_major(expr: &MirRelationExpr) { |
| 652 | let mut todo = vec![expr]; |
| 653 | while let Some(expr) = todo.pop() { |
| 654 | match expr { |
| 655 | MirRelationExpr::LetRec { |
| 656 | ids: _, |
| 657 | values, |
| 658 | limits: _, |
| 659 | body, |
| 660 | } => { |
| 661 | todo.extend(values.iter()); |
| 662 | todo.push(body); |
| 663 | } |
| 664 | _ => { |
| 665 | expr.visit_pre(|expr| { |
| 666 | assert!(!matches!(expr, MirRelationExpr::LetRec { .. })); |
| 667 | }); |
| 668 | } |
| 669 | } |
| 670 | } |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | mod inlining { |