use either::Either;
use crate::ast::{self, support, AstChildren, AstNode};
pub trait HasName: AstNode {
fn name(&self) -> Option<ast::Name> {
support::child(self.syntax())
}
}
pub trait HasLoopBody: AstNode {
fn loop_body(&self) -> Option<ast::BlockExpr> {
support::child(self.syntax())
}
}
pub trait HasArgList: AstNode {
fn arg_list(&self) -> Option<ast::ArgList> {
support::child(self.syntax())
}
}
pub trait HasModuleItem: AstNode {
fn items(&self) -> AstChildren<ast::Item> {
println!("fn items in traits.rs");
support::children(self.syntax())
}
fn statements(&self) -> AstChildren<ast::Stmt> {
support::children(self.syntax())
}
}
impl<A: HasName, B: HasName> HasName for Either<A, B> {}