fixes, safeguards and docs for "compile-time arithmetics"
This commit is contained in:
@@ -757,6 +757,15 @@ impl OpTrait for ArithOp {
|
||||
ArithOp::FloatHypAcot { dst, a } => to_sexp_1_or_2("facoth", dst, a),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_compile_time_evaluable(&self) -> bool {
|
||||
match self {
|
||||
ArithOp::Test { .. } | ArithOp::Compare { .. } | ArithOp::RangeTest { .. }
|
||||
| ArithOp::FloatTest { .. } | ArithOp::FloatCompare { .. } | ArithOp::FloatRangeTest { .. } => false,
|
||||
// rng is allowed... makes little sense, but it also has no side effects
|
||||
_ => true, // a bold claim...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn to_sexp_2_or_3(name: &str, dst: &Wr, a: &Rd, b: &Rd) -> Sexp {
|
||||
|
||||
Reference in New Issue
Block a user