ast: Remove vestigial "ignore" in Expr

This commit is contained in:
John 2023-10-27 00:19:19 -05:00
parent ac540ebd22
commit 35d214c9f6
2 changed files with 6 additions and 8 deletions

View File

@ -210,9 +210,7 @@ pub mod expression {
/// # Syntax
/// [`Expr`]` := `[`math::Operation`]
#[derive(Clone, Debug)]
pub struct Expr {
pub ignore: math::Operation,
}
pub struct Expr (pub math::Operation);
/// A [Primary] Expression is the expression with the highest precedence (i.e. the deepest
/// derivation)
@ -693,7 +691,7 @@ pub mod visitor {
}
impl<T: Visitor<Result<(), E>> + ?Sized, E> Walk<T, Result<(), E>> for Expr {
fn walk(&self, visitor: &mut T) -> Result<(), E> {
visitor.visit_operation(&self.ignore)
visitor.visit_operation(&self.0)
}
}
impl<T: Visitor<Result<(), E>> + ?Sized, E> Walk<T, Result<(), E>> for Group {
@ -804,7 +802,7 @@ pub mod visitor {
/// Visit an [Expression](Expr)
fn visit_expr(&mut self, expr: &Expr) -> R {
self.visit_operation(&expr.ignore)
self.visit_operation(&expr.0)
}
// Block expression
/// Visit a [Block] expression

View File

@ -381,7 +381,7 @@ impl Parser {
/// Parses an [expression](expression::Expr)
fn expr(&mut self) -> PResult<expression::Expr> {
use expression::Expr;
Ok(Expr { ignore: self.assign()? })
Ok(Expr(self.assign()?))
}
/// Parses a [block expression](expression::Block)
fn block(&mut self) -> PResult<expression::Block> {