Skip to main content

cleanup_identities

Function cleanup_identities 

Source
pub fn cleanup_identities<'a>(
    stmts: Vec<Stmt<'a>>,
    expr_arena: &'a Arena<Expr<'a>>,
    stmt_arena: &'a Arena<Stmt<'a>>,
) -> Vec<Stmt<'a>>
Expand description

Remove identity bindings and trivial patterns from residual code.

  • Let x = x → removed
  • Let x = lit; Return xReturn lit
  • Single-arm Inspect with Otherwise only → inline the body
  • Iterates to fixpoint (max 4 passes)