Introduce if-let guards in the HIR
This commit is contained in:
parent
a68864b688
commit
77d80b22f1
6 changed files with 24 additions and 15 deletions
|
@ -1160,6 +1160,7 @@ pub struct Arm<'hir> {
|
|||
#[derive(Debug, HashStable_Generic)]
|
||||
pub enum Guard<'hir> {
|
||||
If(&'hir Expr<'hir>),
|
||||
IfLet(&'hir Pat<'hir>, &'hir Expr<'hir>),
|
||||
}
|
||||
|
||||
#[derive(Debug, HashStable_Generic)]
|
||||
|
|
|
@ -1228,6 +1228,10 @@ pub fn walk_arm<'v, V: Visitor<'v>>(visitor: &mut V, arm: &'v Arm<'v>) {
|
|||
if let Some(ref g) = arm.guard {
|
||||
match g {
|
||||
Guard::If(ref e) => visitor.visit_expr(e),
|
||||
Guard::IfLet(ref pat, ref e) => {
|
||||
visitor.visit_pat(pat);
|
||||
visitor.visit_expr(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
visitor.visit_expr(&arm.body);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue