Separate op-assignment with other function calls.
This commit is contained in:
parent
49e5382ab0
commit
9495d3f733
@ -1681,7 +1681,9 @@ impl Engine {
|
|||||||
let pos = rhs.position();
|
let pos = rhs.position();
|
||||||
|
|
||||||
if self
|
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
|
.0
|
||||||
.as_bool()
|
.as_bool()
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
@ -1961,7 +1963,7 @@ impl Engine {
|
|||||||
let hash_fn =
|
let hash_fn =
|
||||||
calc_native_fn_hash(empty(), op, args.iter().map(|a| a.type_id())).unwrap();
|
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(_) => (),
|
Ok(_) => (),
|
||||||
Err(err) if matches!(err.as_ref(), EvalAltResult::ErrorFunctionNotFound(f, _) if f.starts_with(op)) =>
|
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();
|
calc_native_fn_hash(empty(), op, args.iter().map(|a| a.type_id())).unwrap();
|
||||||
|
|
||||||
// Run function
|
// Run function
|
||||||
let (value, _) =
|
let (value, _) = self
|
||||||
self.call_native_fn(mods, state, lib, op, hash_fn, args, true, op_pos)?;
|
.call_native_fn(mods, state, lib, op, hash_fn, args, true, false, op_pos)?;
|
||||||
|
|
||||||
*args[0] = value.flatten();
|
*args[0] = value.flatten();
|
||||||
}
|
}
|
||||||
|
@ -149,6 +149,7 @@ fn call_fn_with_constant_arguments(
|
|||||||
hash_fn.unwrap(),
|
hash_fn.unwrap(),
|
||||||
arg_values.iter_mut().collect::<StaticVec<_>>().as_mut(),
|
arg_values.iter_mut().collect::<StaticVec<_>>().as_mut(),
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
Position::NONE,
|
Position::NONE,
|
||||||
)
|
)
|
||||||
.ok()
|
.ok()
|
||||||
|
@ -145,7 +145,12 @@ mod logic_functions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Err(Box::new(EvalAltResult::ErrorFunctionNotFound(
|
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,
|
Position::NONE,
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
@ -1657,14 +1657,6 @@ pub fn is_valid_identifier(name: impl Iterator<Item = char>) -> bool {
|
|||||||
first_alphabetic
|
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?
|
/// Is a character valid to start an identifier?
|
||||||
#[cfg(feature = "unicode-xid-ident")]
|
#[cfg(feature = "unicode-xid-ident")]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user