Cleanup fold code and split logic to fold single elements

This commit is contained in:
Adolfo Ochagavía 2018-10-12 19:20:58 +02:00
parent ee0a6bf053
commit 4b3737510b
4 changed files with 115 additions and 43 deletions

View file

@ -2193,3 +2193,21 @@ impl<'a> WhileExpr<'a> {
}
}
// Whitespace
#[derive(Debug, Clone, Copy)]
pub struct Whitespace<'a> {
syntax: SyntaxNodeRef<'a>,
}
impl<'a> AstNode<'a> for Whitespace<'a> {
fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
match syntax.kind() {
WHITESPACE => Some(Whitespace { syntax }),
_ => None,
}
}
fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
}
impl<'a> Whitespace<'a> {}