1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Squashes group expressions
use crate::{ast::*, ast_visitor::fold::*};

/// Squashes group expressions
pub struct SquashGroups;

impl Fold for SquashGroups {
    fn fold_expr_kind(&mut self, kind: ExprKind) -> ExprKind {
        match kind {
            ExprKind::Group(Group { expr }) => self.fold_expr_kind(*expr),
            _ => or_fold_expr_kind(self, kind),
        }
    }
}