diff --git a/crates/conjure_core/src/ast/expressions.rs b/crates/conjure_core/src/ast/expressions.rs index 86bb9847f2..6581186a3a 100644 --- a/crates/conjure_core/src/ast/expressions.rs +++ b/crates/conjure_core/src/ast/expressions.rs @@ -342,6 +342,14 @@ impl Expression { None } } + + /// True if the expression is an associative and commutative operator + pub fn is_associative_commutative_operator(&self) -> bool { + matches!( + self, + Expression::Sum(_, _) | Expression::Or(_, _) | Expression::And(_, _) + ) + } } fn display_expressions(expressions: &[Expression]) -> String {