pub fn check_boolean_result(ast: &Expression) -> Result<()>Expand description
Checks if the top level Expression produces a Value::Boolean result.
§Examples
use slac::{check_boolean_result, Expression, Operator, Value};
let ast = Expression::Binary {
left: Box::new(Expression::Literal{value: Value::Boolean(true)}),
right: Box::new(Expression::Literal{value: Value::Boolean(true)}),
operator: Operator::And,
};
assert!(check_boolean_result(&ast).is_ok());§Errors
Returns an Error when the top most Expression can’t evaluate to a Value::Boolean.