feat: add ExprRef sumtype with better expression iteration
This commit is contained in:
parent
79384d436d
commit
0359029741
5 changed files with 93 additions and 19 deletions
|
|
@ -1,19 +1,17 @@
|
|||
use std::any::Any;
|
||||
|
||||
use super::iter::AstIter;
|
||||
use super::{iter::AstIter, ExprRef};
|
||||
|
||||
/// A trait representing expressions
|
||||
pub trait Expr {
|
||||
fn args(&self) -> Vec<&dyn Expr>;
|
||||
fn is_numeric(&self) -> bool;
|
||||
fn is_boolean(&self) -> bool;
|
||||
|
||||
fn args(&self) -> Vec<ExprRef<'_>>;
|
||||
|
||||
fn as_any(&self) -> &dyn Any;
|
||||
|
||||
fn iter(&self) -> AstIter<'_>
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
AstIter::new(self)
|
||||
}
|
||||
fn iter(&self) -> AstIter<'_>;
|
||||
}
|
||||
|
||||
impl dyn Expr {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue