This commit is contained in:
Aleksey Kladov 2018-08-27 10:01:31 +03:00
parent 9b69c7df19
commit 8b0298ce09
7 changed files with 155 additions and 75 deletions

View file

@ -383,6 +383,24 @@ impl<'a> AstNode<'a> for Expr<'a> {
impl<'a> Expr<'a> {}
// ExprStmt
#[derive(Debug, Clone, Copy)]
pub struct ExprStmt<'a> {
syntax: SyntaxNodeRef<'a>,
}
impl<'a> AstNode<'a> for ExprStmt<'a> {
fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
match syntax.kind() {
EXPR_STMT => Some(ExprStmt { syntax }),
_ => None,
}
}
fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
}
impl<'a> ExprStmt<'a> {}
// FieldExpr
#[derive(Debug, Clone, Copy)]
pub struct FieldExpr<'a> {
@ -442,6 +460,10 @@ impl<'a> FnDef<'a> {
pub fn param_list(self) -> Option<ParamList<'a>> {
super::child_opt(self)
}
pub fn body(self) -> Option<Block<'a>> {
super::child_opt(self)
}
}
// FnPointerType
@ -626,6 +648,10 @@ impl<'a> LetStmt<'a> {
pub fn pat(self) -> Option<Pat<'a>> {
super::child_opt(self)
}
pub fn initializer(self) -> Option<Expr<'a>> {
super::child_opt(self)
}
}
// LoopExpr