ast: Add use, tackle remaining low-hanging fruit

This commit is contained in:
2025-10-21 07:09:12 -04:00
parent 9cccac5910
commit ccb6bef6d9
5 changed files with 106 additions and 64 deletions

View File

@@ -127,6 +127,8 @@ impl<A: Annotation> Match<A> for Expr<A> {
(Expr::Id(_), _) => false,
(Expr::Lit(pat), Expr::Lit(expr)) => pat == expr,
(Expr::Lit(_), _) => false,
(Expr::Use(_), Expr::Use(_)) => true,
(Expr::Use(_), _) => false,
(Expr::Bind(pat), Expr::Bind(expr)) => Match::recurse(sub, pat, expr),
(Expr::Bind(..), _) => false,
(Expr::Struct(pat), Expr::Struct(expr)) => Match::recurse(sub, pat, expr),
@@ -147,7 +149,7 @@ impl<A: Annotation> Match<A> for Expr<A> {
*self = expr.clone()
}
}
Expr::Id(_) | Expr::Lit(_) => {}
Expr::Id(_) | Expr::Lit(_) | Expr::Use(_) => {}
Expr::Bind(expr) => expr.apply(sub),
Expr::Struct(expr) => expr.apply(sub),
Expr::Make(expr) => expr.apply(sub),