TypeParamList Owner

This commit is contained in:
Aleksey Kladov 2018-08-22 16:46:42 +03:00
parent 55896aedb1
commit 8e3bec11eb
5 changed files with 118 additions and 26 deletions

View file

@ -24,6 +24,22 @@ pub trait NameOwner<'a>: AstNode<'a> {
}
}
pub trait TypeParamsOwner<'a>: AstNode<'a> {
fn type_param_list(self) -> Option<TypeParamList<'a>> {
self.syntax()
.children()
.filter_map(TypeParamList::cast)
.next()
}
fn where_clause(self) -> Option<WhereClause<'a>> {
self.syntax()
.children()
.filter_map(WhereClause::cast)
.next()
}
}
pub trait AttrsOwner<'a>: AstNode<'a> {
fn attrs(&self) -> Box<Iterator<Item=Attr<'a>> + 'a> {
let it = self.syntax().children()