diff options
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 1 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/traits.rs | 7 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 3 |
3 files changed, 10 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 9f9d6e63c..73e1c407c 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -1129,6 +1129,7 @@ impl ast::NameOwner for FnDef {} | |||
1129 | impl ast::TypeParamsOwner for FnDef {} | 1129 | impl ast::TypeParamsOwner for FnDef {} |
1130 | impl ast::AttrsOwner for FnDef {} | 1130 | impl ast::AttrsOwner for FnDef {} |
1131 | impl ast::DocCommentsOwner for FnDef {} | 1131 | impl ast::DocCommentsOwner for FnDef {} |
1132 | impl ast::AsyncOwner for FnDef {} | ||
1132 | impl FnDef { | 1133 | impl FnDef { |
1133 | pub fn param_list(&self) -> Option<ParamList> { | 1134 | pub fn param_list(&self) -> Option<ParamList> { |
1134 | AstChildren::new(&self.syntax).next() | 1135 | AstChildren::new(&self.syntax).next() |
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 | ||
13 | pub trait TypeAscriptionOwner: AstNode { | 14 | pub trait TypeAscriptionOwner: AstNode { |
@@ -105,6 +106,12 @@ pub trait AttrsOwner: AstNode { | |||
105 | } | 106 | } |
106 | } | 107 | } |
107 | 108 | ||
109 | pub 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 | |||
108 | pub trait DocCommentsOwner: AstNode { | 115 | pub 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() } |
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 08aafb610..7d11f0176 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -275,7 +275,8 @@ Grammar( | |||
275 | "NameOwner", | 275 | "NameOwner", |
276 | "TypeParamsOwner", | 276 | "TypeParamsOwner", |
277 | "AttrsOwner", | 277 | "AttrsOwner", |
278 | "DocCommentsOwner" | 278 | "DocCommentsOwner", |
279 | "AsyncOwner" | ||
279 | ], | 280 | ], |
280 | options: [ "ParamList", ["body", "BlockExpr"], "RetType" ], | 281 | options: [ "ParamList", ["body", "BlockExpr"], "RetType" ], |
281 | ), | 282 | ), |