Refactor FnCallHashes.

This commit is contained in:
Stephen Chung
2023-02-11 12:52:07 +08:00
parent e177a5648a
commit 9cb5154979
4 changed files with 88 additions and 63 deletions

View File

@@ -457,14 +457,15 @@ impl<'a> NativeCallContext<'a> {
// Native or script
let hash = if is_method_call {
FnCallHashes::from_all(
#[cfg(not(feature = "no_function"))]
let hash = match is_method_call {
#[cfg(not(feature = "no_function"))]
true => FnCallHashes::from_script_and_native(
calc_fn_hash(None, fn_name, args_len - 1),
calc_fn_hash(None, fn_name, args_len),
)
} else {
calc_fn_hash(None, fn_name, args_len).into()
),
#[cfg(feature = "no_function")]
true => FnCallHashes::from_native_only(calc_fn_hash(None, fn_name, args_len)),
_ => FnCallHashes::from_hash(calc_fn_hash(None, fn_name, args_len)),
};
self.engine()