aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/traits.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast/traits.rs')
-rw-r--r--crates/ra_syntax/src/ast/traits.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs
index f99984fe0..8bf6aa2f0 100644
--- a/crates/ra_syntax/src/ast/traits.rs
+++ b/crates/ra_syntax/src/ast/traits.rs
@@ -8,6 +8,7 @@ use crate::{
8 ast::{self, child_opt, children, AstChildren, AstNode, AstToken}, 8 ast::{self, child_opt, children, AstChildren, AstNode, AstToken},
9 match_ast, 9 match_ast,
10 syntax_node::{SyntaxElementChildren, SyntaxNodeChildren}, 10 syntax_node::{SyntaxElementChildren, SyntaxNodeChildren},
11 SyntaxKind,
11}; 12};
12 13
13pub trait TypeAscriptionOwner: AstNode { 14pub trait TypeAscriptionOwner: AstNode {
@@ -105,6 +106,12 @@ pub trait AttrsOwner: AstNode {
105 } 106 }
106} 107}
107 108
109pub trait AsyncOwner: AstNode {
110 fn is_async(&self) -> bool {
111 self.syntax().children_with_tokens().any(|t| t.kind() == SyntaxKind::ASYNC_KW)
112 }
113}
114
108pub trait DocCommentsOwner: AstNode { 115pub trait DocCommentsOwner: AstNode {
109 fn doc_comments(&self) -> CommentIter { 116 fn doc_comments(&self) -> CommentIter {
110 CommentIter { iter: self.syntax().children_with_tokens() } 117 CommentIter { iter: self.syntax().children_with_tokens() }