diff --git a/src/engine.rs b/src/engine.rs index 07740bad..ae295998 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -1681,7 +1681,9 @@ impl Engine { let pos = rhs.position(); if self - .call_native_fn(mods, state, lib, OP_EQUALS, hash_fn, args, false, pos)? + .call_native_fn( + mods, state, lib, OP_EQUALS, hash_fn, args, false, false, pos, + )? .0 .as_bool() .unwrap_or(false) @@ -1961,7 +1963,7 @@ impl Engine { let hash_fn = calc_native_fn_hash(empty(), op, args.iter().map(|a| a.type_id())).unwrap(); - match self.call_native_fn(mods, state, lib, op, hash_fn, args, true, op_pos) { + match self.call_native_fn(mods, state, lib, op, hash_fn, args, true, true, op_pos) { Ok(_) => (), Err(err) if matches!(err.as_ref(), EvalAltResult::ErrorFunctionNotFound(f, _) if f.starts_with(op)) => { @@ -1971,8 +1973,8 @@ impl Engine { calc_native_fn_hash(empty(), op, args.iter().map(|a| a.type_id())).unwrap(); // Run function - let (value, _) = - self.call_native_fn(mods, state, lib, op, hash_fn, args, true, op_pos)?; + let (value, _) = self + .call_native_fn(mods, state, lib, op, hash_fn, args, true, false, op_pos)?; *args[0] = value.flatten(); } diff --git a/src/optimize.rs b/src/optimize.rs index 64b6140d..64609e60 100644 --- a/src/optimize.rs +++ b/src/optimize.rs @@ -149,6 +149,7 @@ fn call_fn_with_constant_arguments( hash_fn.unwrap(), arg_values.iter_mut().collect::>().as_mut(), false, + false, Position::NONE, ) .ok() diff --git a/src/packages/logic.rs b/src/packages/logic.rs index 8876b5a6..fdd6e0a3 100644 --- a/src/packages/logic.rs +++ b/src/packages/logic.rs @@ -145,7 +145,12 @@ mod logic_functions { } Err(Box::new(EvalAltResult::ErrorFunctionNotFound( - format!("{} ({}, {})", ctx.fn_name(), x.type_name(), y.type_name()), + format!( + "{} ({}, {})", + ctx.fn_name(), + ctx.engine().map_type_name(x.type_name()), + ctx.engine().map_type_name(y.type_name()) + ), Position::NONE, ))) } diff --git a/src/token.rs b/src/token.rs index 7e2c7b42..ea25f37a 100644 --- a/src/token.rs +++ b/src/token.rs @@ -1657,14 +1657,6 @@ pub fn is_valid_identifier(name: impl Iterator) -> bool { first_alphabetic } -/// Is a text string an assignment operator? -pub fn is_assignment_operator(op: &str) -> bool { - match op { - "+=" | "-=" | "*=" | "/=" | "<<=" | ">>=" | "&=" | "|=" | "^=" | "%=" | "**=" => true, - _ => false, - } -} - /// Is a character valid to start an identifier? #[cfg(feature = "unicode-xid-ident")] #[inline(always)]