complete struct literals

This commit is contained in:
Aleksey Kladov 2019-02-24 17:01:56 +03:00
parent 666303faf3
commit 65a2be4953
4 changed files with 78 additions and 0 deletions

View file

@ -724,6 +724,12 @@ impl LiteralExpr {
}
}
impl NamedField {
pub fn parent_struct_lit(&self) -> &StructLit {
self.syntax().ancestors().find_map(StructLit::cast).unwrap()
}
}
impl BindPat {
pub fn is_mutable(&self) -> bool {
self.syntax().children().any(|n| n.kind() == MUT_KW)