aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-12-24 11:45:28 +0000
committerEdwin Cheng <[email protected]>2019-12-24 11:45:28 +0000
commit0edb5b4a501a66baa7db8ececf46135e6246f4de (patch)
treea65f9899f109d4df2c05069e037fe5dec0545d73 /crates/ra_syntax/src/ast
parent60aa4d12f95477565d5b01f122d2c9dd845015b4 (diff)
Implement infer await from async func
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs1
-rw-r--r--crates/ra_syntax/src/ast/traits.rs7
2 files changed, 8 insertions, 0 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 {}
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 {}
1132impl FnDef { 1133impl 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
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() }