MCPcopy Create free account
hub / github.com/aspizu/goboscript / is_expr_boolean

Function is_expr_boolean

src/codegen/input.rs:33–61  ·  view source on GitHub ↗
(expr: &Expr)

Source from the content-addressed store, hash-verified

31};
32
33pub 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
63pub fn coerce_condition(expr: &Expr) -> Expr {
64 if is_expr_boolean(expr) {

Callers 3

coerce_conditionFunction · 0.85
un_opMethod · 0.85
bin_opMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected