diff options
Diffstat (limited to 'crates/libsyntax2/src/ast/mod.rs')
-rw-r--r-- | crates/libsyntax2/src/ast/mod.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/libsyntax2/src/ast/mod.rs b/crates/libsyntax2/src/ast/mod.rs index 5b9a07db4..1784b871e 100644 --- a/crates/libsyntax2/src/ast/mod.rs +++ b/crates/libsyntax2/src/ast/mod.rs | |||
@@ -24,6 +24,22 @@ pub trait NameOwner<'a>: AstNode<'a> { | |||
24 | } | 24 | } |
25 | } | 25 | } |
26 | 26 | ||
27 | pub trait TypeParamsOwner<'a>: AstNode<'a> { | ||
28 | fn type_param_list(self) -> Option<TypeParamList<'a>> { | ||
29 | self.syntax() | ||
30 | .children() | ||
31 | .filter_map(TypeParamList::cast) | ||
32 | .next() | ||
33 | } | ||
34 | |||
35 | fn where_clause(self) -> Option<WhereClause<'a>> { | ||
36 | self.syntax() | ||
37 | .children() | ||
38 | .filter_map(WhereClause::cast) | ||
39 | .next() | ||
40 | } | ||
41 | } | ||
42 | |||
27 | pub trait AttrsOwner<'a>: AstNode<'a> { | 43 | pub trait AttrsOwner<'a>: AstNode<'a> { |
28 | fn attrs(&self) -> Box<Iterator<Item=Attr<'a>> + 'a> { | 44 | fn attrs(&self) -> Box<Iterator<Item=Attr<'a>> + 'a> { |
29 | let it = self.syntax().children() | 45 | let it = self.syntax().children() |