aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir_def/src/data.rs4
-rw-r--r--crates/ra_syntax/src/ast/extensions.rs4
-rw-r--r--crates/ra_syntax/src/ast/generated.rs1
-rw-r--r--crates/ra_syntax/src/ast/traits.rs7
-rw-r--r--crates/ra_syntax/src/grammar.ron3
5 files changed, 6 insertions, 13 deletions
diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs
index a1b31c411..c900a6a18 100644
--- a/crates/ra_hir_def/src/data.rs
+++ b/crates/ra_hir_def/src/data.rs
@@ -6,9 +6,7 @@ use hir_expand::{
6 name::{name, AsName, Name}, 6 name::{name, AsName, Name},
7 AstId, InFile, 7 AstId, InFile,
8}; 8};
9use ra_syntax::ast::{ 9use ra_syntax::ast::{self, AstNode, ImplItem, ModuleItemOwner, NameOwner, TypeAscriptionOwner};
10 self, AstNode, AsyncOwner, ImplItem, ModuleItemOwner, NameOwner, TypeAscriptionOwner,
11};
12 10
13use crate::{ 11use crate::{
14 db::DefDatabase, 12 db::DefDatabase,
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs
index a8f625176..baaef3023 100644
--- a/crates/ra_syntax/src/ast/extensions.rs
+++ b/crates/ra_syntax/src/ast/extensions.rs
@@ -221,6 +221,10 @@ impl ast::FnDef {
221 .and_then(|it| it.into_token()) 221 .and_then(|it| it.into_token())
222 .filter(|it| it.kind() == T![;]) 222 .filter(|it| it.kind() == T![;])
223 } 223 }
224
225 pub fn is_async(&self) -> bool {
226 self.syntax().children_with_tokens().any(|it| it.kind() == T![async])
227 }
224} 228}
225 229
226impl ast::LetStmt { 230impl ast::LetStmt {
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 73e1c407c..9f9d6e63c 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -1129,7 +1129,6 @@ impl ast::NameOwner for FnDef {}
1129impl ast::TypeParamsOwner for FnDef {} 1129impl ast::TypeParamsOwner for FnDef {}
1130impl ast::AttrsOwner for FnDef {} 1130impl ast::AttrsOwner for FnDef {}
1131impl ast::DocCommentsOwner for FnDef {} 1131impl ast::DocCommentsOwner for FnDef {}
1132impl ast::AsyncOwner for FnDef {}
1133impl FnDef { 1132impl FnDef {
1134 pub fn param_list(&self) -> Option<ParamList> { 1133 pub fn param_list(&self) -> Option<ParamList> {
1135 AstChildren::new(&self.syntax).next() 1134 AstChildren::new(&self.syntax).next()
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs
index 8bf6aa2f0..f99984fe0 100644
--- a/crates/ra_syntax/src/ast/traits.rs
+++ b/crates/ra_syntax/src/ast/traits.rs
@@ -8,7 +8,6 @@ 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,
12}; 11};
13 12
14pub trait TypeAscriptionOwner: AstNode { 13pub trait TypeAscriptionOwner: AstNode {
@@ -106,12 +105,6 @@ pub trait AttrsOwner: AstNode {
106 } 105 }
107} 106}
108 107
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
115pub trait DocCommentsOwner: AstNode { 108pub trait DocCommentsOwner: AstNode {
116 fn doc_comments(&self) -> CommentIter { 109 fn doc_comments(&self) -> CommentIter {
117 CommentIter { iter: self.syntax().children_with_tokens() } 110 CommentIter { iter: self.syntax().children_with_tokens() }
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index 7d11f0176..08aafb610 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -275,8 +275,7 @@ Grammar(
275 "NameOwner", 275 "NameOwner",
276 "TypeParamsOwner", 276 "TypeParamsOwner",
277 "AttrsOwner", 277 "AttrsOwner",
278 "DocCommentsOwner", 278 "DocCommentsOwner"
279 "AsyncOwner"
280 ], 279 ],
281 options: [ "ParamList", ["body", "BlockExpr"], "RetType" ], 280 options: [ "ParamList", ["body", "BlockExpr"], "RetType" ],
282 ), 281 ),