mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Add ret type
This commit is contained in:
parent
b00a4d43ec
commit
2257c08cb1
14 changed files with 208 additions and 77 deletions
|
@ -523,6 +523,10 @@ impl<'a> FnDef<'a> {
|
|||
pub fn body(self) -> Option<Block<'a>> {
|
||||
super::child_opt(self)
|
||||
}
|
||||
|
||||
pub fn ret_type(self) -> Option<RetType<'a>> {
|
||||
super::child_opt(self)
|
||||
}
|
||||
}
|
||||
|
||||
// FnPointerType
|
||||
|
@ -1412,6 +1416,24 @@ impl<'a> AstNode<'a> for ReferenceType<'a> {
|
|||
|
||||
impl<'a> ReferenceType<'a> {}
|
||||
|
||||
// RetType
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct RetType<'a> {
|
||||
syntax: SyntaxNodeRef<'a>,
|
||||
}
|
||||
|
||||
impl<'a> AstNode<'a> for RetType<'a> {
|
||||
fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
|
||||
match syntax.kind() {
|
||||
RET_TYPE => Some(RetType { syntax }),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
|
||||
}
|
||||
|
||||
impl<'a> RetType<'a> {}
|
||||
|
||||
// ReturnExpr
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct ReturnExpr<'a> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue