Generate accessors

This commit is contained in:
Aleksey Kladov
2018-08-11 09:55:32 +03:00
parent 7581984601
commit b18d2882f4
4 changed files with 42 additions and 20 deletions

View File

@@ -22,22 +22,9 @@ impl<R: TreeRoot> File<R> {
pub fn errors(&self) -> Vec<SyntaxError> {
self.syntax().root.errors.clone()
}
pub fn functions<'a>(&'a self) -> impl Iterator<Item = Function<R>> + 'a {
self.syntax()
.children()
.filter_map(Function::cast)
}
}
impl<R: TreeRoot> Function<R> {
pub fn name(&self) -> Option<Name<R>> {
self.syntax()
.children()
.filter_map(Name::cast)
.next()
}
pub fn has_atom_attr(&self, atom: &str) -> bool {
self.syntax()
.children()