Add no_float feature to disable floating-point.

This commit is contained in:
Stephen Chung
2020-03-10 18:32:01 +08:00
parent 52b5732bcb
commit cc772c6e2a
6 changed files with 206 additions and 125 deletions

View File

@@ -768,8 +768,10 @@ impl Engine<'_> {
/// Evaluate an expression
fn eval_expr(&mut self, scope: &mut Scope, expr: &Expr) -> Result<Dynamic, EvalAltResult> {
match expr {
Expr::IntegerConstant(i, _) => Ok(i.into_dynamic()),
#[cfg(not(feature = "no_float"))]
Expr::FloatConstant(f, _) => Ok(f.into_dynamic()),
Expr::IntegerConstant(i, _) => Ok(i.into_dynamic()),
Expr::StringConstant(s, _) => Ok(s.into_dynamic()),
Expr::CharConstant(c, _) => Ok(c.into_dynamic()),
Expr::Identifier(id, pos) => {