support ref-patterns

This commit is contained in:
Aleksey Kladov 2019-01-13 13:34:57 +03:00
parent 40686722ba
commit 8e554ea5fa
5 changed files with 46 additions and 11 deletions

View file

@ -348,6 +348,12 @@ impl UseTreeList {
}
}
impl RefPat {
pub fn is_mut(&self) -> bool {
self.syntax().children().any(|n| n.kind() == MUT_KW)
}
}
fn child_opt<P: AstNode, C: AstNode>(parent: &P) -> Option<&C> {
children(parent).next()
}