Fix no_std build.

This commit is contained in:
Stephen Chung 2020-08-25 09:41:52 +08:00
parent 790878f209
commit 402c85ca65

View File

@ -52,6 +52,10 @@ use crate::stdlib::{
#[cfg(not(feature = "no_function"))]
use crate::stdlib::{collections::HashSet, string::String};
#[cfg(feature = "no_std")]
#[cfg(not(feature = "no_float"))]
use num_traits::float::Float;
/// Extract the property name from a getter function name.
#[inline(always)]
fn extract_prop_from_getter(_fn_name: &str) -> Option<&str> {
@ -1147,8 +1151,8 @@ pub fn run_builtin_binary_op(
"/" => return Ok(Some((x / y).into())),
"%" => return Ok(Some((x % y).into())),
"~" => return Ok(Some(x.pow(y as u32).into())),
">>" => return shr_u(x, y).map(Into::into).map(Some),
"<<" => return shl_u(x, y).map(Into::into).map(Some),
">>" => return Ok(Some((x >> y).into())),
"<<" => return Ok(Some((x << y).into())),
_ => (),
}
}
@ -1274,9 +1278,9 @@ pub fn run_builtin_op_assignment(
"*=" => return Ok(Some(*x *= y)),
"/=" => return Ok(Some(*x /= y)),
"%=" => return Ok(Some(*x %= y)),
"~=" => return Ok(Some(*x = (*x).pow(y as u32))),
">>=" => return Ok(Some(*x = shr_u(*x, y)?)),
"<<=" => return Ok(Some(*x = shl_u(*x, y)?)),
"~=" => return Ok(Some(*x = x.pow(y as u32))),
">>=" => return Ok(Some(*x = *x >> y)),
"<<=" => return Ok(Some(*x = *x << y)),
_ => (),
}
}
@ -1317,7 +1321,7 @@ pub fn run_builtin_op_assignment(
"*=" => return Ok(Some(*x *= y)),
"/=" => return Ok(Some(*x /= y)),
"%=" => return Ok(Some(*x %= y)),
"~=" => return Ok(Some(*x = (*x).powf(y))),
"~=" => return Ok(Some(*x = x.powf(y))),
_ => (),
}
}