mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Implement infer await from async func
This commit is contained in:
parent
60aa4d12f9
commit
0edb5b4a50
7 changed files with 112 additions and 5 deletions
|
@ -1129,6 +1129,7 @@ impl ast::NameOwner for FnDef {}
|
|||
impl ast::TypeParamsOwner for FnDef {}
|
||||
impl ast::AttrsOwner for FnDef {}
|
||||
impl ast::DocCommentsOwner for FnDef {}
|
||||
impl ast::AsyncOwner for FnDef {}
|
||||
impl FnDef {
|
||||
pub fn param_list(&self) -> Option<ParamList> {
|
||||
AstChildren::new(&self.syntax).next()
|
||||
|
|
|
@ -8,6 +8,7 @@ use crate::{
|
|||
ast::{self, child_opt, children, AstChildren, AstNode, AstToken},
|
||||
match_ast,
|
||||
syntax_node::{SyntaxElementChildren, SyntaxNodeChildren},
|
||||
SyntaxKind,
|
||||
};
|
||||
|
||||
pub trait TypeAscriptionOwner: AstNode {
|
||||
|
@ -105,6 +106,12 @@ pub trait AttrsOwner: AstNode {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait AsyncOwner: AstNode {
|
||||
fn is_async(&self) -> bool {
|
||||
self.syntax().children_with_tokens().any(|t| t.kind() == SyntaxKind::ASYNC_KW)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait DocCommentsOwner: AstNode {
|
||||
fn doc_comments(&self) -> CommentIter {
|
||||
CommentIter { iter: self.syntax().children_with_tokens() }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue