Add ret type

This commit is contained in:
Aleksey Kladov 2018-08-28 21:11:17 +03:00
parent b00a4d43ec
commit 2257c08cb1
14 changed files with 208 additions and 77 deletions

View file

@ -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> {