(expr: &Expr)
| 31 | }; |
| 32 | |
| 33 | pub fn is_expr_boolean(expr: &Expr) -> bool { |
| 34 | matches!( |
| 35 | expr, |
| 36 | Expr::UnOp { op: UnOp::Not, .. } |
| 37 | | Expr::BinOp { |
| 38 | op: BinOp::Eq |
| 39 | | BinOp::Ne |
| 40 | | BinOp::Lt |
| 41 | | BinOp::Le |
| 42 | | BinOp::Gt |
| 43 | | BinOp::Ge |
| 44 | | BinOp::And |
| 45 | | BinOp::Or |
| 46 | | BinOp::In, |
| 47 | .. |
| 48 | } |
| 49 | | Expr::Repr { |
| 50 | repr: Repr::ColorIsTouchingColor |
| 51 | | Repr::KeyPressed |
| 52 | | Repr::MouseDown |
| 53 | | Repr::Touching |
| 54 | | Repr::TouchingColor |
| 55 | | Repr::TouchingEdge |
| 56 | | Repr::TouchingMousePointer |
| 57 | | Repr::Contains, |
| 58 | .. |
| 59 | } |
| 60 | ) |
| 61 | } |
| 62 | |
| 63 | pub fn coerce_condition(expr: &Expr) -> Expr { |
| 64 | if is_expr_boolean(expr) { |
no outgoing calls
no test coverage detected