Skip to content

Commit

Permalink
Fix builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
schungx committed Jan 30, 2024
1 parent 2c7e179 commit db7466b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/api/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ impl Engine {
name: impl AsRef<str> + Into<Identifier>,
func: FUNC,
) -> &mut Self {
let mut reg = FuncRegistration::new(name.into()).with_namespace(FnNamespace::Global);
let reg = FuncRegistration::new(name.into()).with_namespace(FnNamespace::Global);

#[cfg(feature = "metadata")]
{
let reg = {
let mut param_type_names = FUNC::param_names()
.iter()
.map(|ty| format!("_: {}", self.format_param_type(ty)))
Expand All @@ -93,8 +93,8 @@ impl Engine {
.map(String::as_str)
.collect::<crate::FnArgsVec<_>>();

reg = reg.with_params_info(param_type_names);
}
reg.with_params_info(param_type_names)
};

reg.set_into_module(self.global_namespace_mut(), func);

Expand Down
1 change: 1 addition & 0 deletions src/module/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ impl FuncRegistration {
f.num_params = arg_types.as_ref().len();
f.param_types.extend(arg_types.as_ref().iter().copied());

#[cfg(any(not(feature = "no_index"), not(feature = "no_object")))]
if (f.name == crate::engine::FN_IDX_GET && f.num_params == 2)
|| (f.name == crate::engine::FN_IDX_SET && f.num_params == 3)
{
Expand Down
20 changes: 10 additions & 10 deletions src/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1591,8 +1591,8 @@ fn get_next_token_inner(
let mut result = SmartString::new_const();
let mut radix_base: Option<u32> = None;
let mut valid: fn(char) -> bool = is_numeric_digit;
let mut has_period = false;
let mut has_e = false;
let mut _has_period = false;
let mut _has_e = false;

result.push(c);

Expand All @@ -1606,7 +1606,7 @@ fn get_next_token_inner(
stream.eat_next_and_advance(pos);
}
#[cfg(any(not(feature = "no_float"), feature = "decimal"))]
'.' if !has_period && radix_base.is_none() => {
'.' if !_has_period && radix_base.is_none() => {
stream.get_next().unwrap();

// Check if followed by digits or something that cannot start a property name
Expand All @@ -1615,7 +1615,7 @@ fn get_next_token_inner(
Some('0'..='9') => {
result.push('.');
pos.advance();
has_period = true;
_has_period = true;
}
// _ - cannot follow a decimal point
Some(NUMBER_SEPARATOR) => {
Expand All @@ -1632,7 +1632,7 @@ fn get_next_token_inner(
result.push('.');
pos.advance();
result.push('0');
has_period = true;
_has_period = true;
}
// Not a floating-point number
_ => {
Expand All @@ -1642,7 +1642,7 @@ fn get_next_token_inner(
}
}
#[cfg(not(feature = "no_float"))]
'e' if !has_e && radix_base.is_none() => {
'e' if !_has_e && radix_base.is_none() => {
stream.get_next().unwrap();

// Check if followed by digits or +/-
Expand All @@ -1651,17 +1651,17 @@ fn get_next_token_inner(
Some('0'..='9') => {
result.push('e');
pos.advance();
has_e = true;
has_period = true;
_has_e = true;
_has_period = true;
}
// +/- after e - accept the e and the sign (no decimal points allowed)
Some('+' | '-') => {
result.push('e');
pos.advance();
result.push(stream.get_next().unwrap());
pos.advance();
has_e = true;
has_period = true;
_has_e = true;
_has_period = true;
}
// Not a floating-point number
_ => {
Expand Down

0 comments on commit db7466b

Please sign in to comment.