Always call native for op-assignment operators.

This commit is contained in:
Stephen Chung
2021-02-23 20:32:50 +08:00
parent 123e9d6901
commit 6f876e85cc
4 changed files with 54 additions and 43 deletions

View File

@@ -214,17 +214,20 @@ impl Engine {
// Try all permutations with `Dynamic` wildcards
_ => {
// Qualifiers (none) + function name + number of arguments + argument `TypeId`'s.
let arg_types = args.iter().enumerate().map(|(i, a)| {
let mask = 1usize << (num_args - i - 1);
if bitmask & mask != 0 {
// Replace with `Dynamic`
TypeId::of::<Dynamic>()
} else {
a.type_id()
}
});
hash = calc_native_fn_hash(empty(), fn_name, arg_types).unwrap();
hash = calc_native_fn_hash(
empty(),
fn_name,
args.iter().enumerate().map(|(i, a)| {
let mask = 1usize << (num_args - i - 1);
if bitmask & mask != 0 {
// Replace with `Dynamic`
TypeId::of::<Dynamic>()
} else {
a.type_id()
}
}),
)
.unwrap();
// Stop when all permutations are exhausted
if hash == hash_fn {
@@ -613,9 +616,8 @@ impl Engine {
ensure_no_data_race(fn_name, args, is_ref)?;
}
// Qualifiers (none) + function name + number of arguments + argument `TypeId`'s.
let arg_types = args.iter().map(|a| a.type_id());
let hash_fn = calc_native_fn_hash(empty(), fn_name, arg_types).unwrap();
let hash_fn =
calc_native_fn_hash(empty(), fn_name, args.iter().map(|a| a.type_id())).unwrap();
match fn_name {
// type_of