Refine native/script code splits.

This commit is contained in:
Stephen Chung
2022-10-30 15:45:25 +08:00
parent d97f3f7ec4
commit c9184db4d2
10 changed files with 163 additions and 158 deletions

View File

@@ -223,16 +223,9 @@ impl Engine {
hashes,
args,
operator_token,
#[cfg(not(feature = "no_function"))]
can_be_script,
..
} = expr;
#[cfg(not(feature = "no_function"))]
let native = !can_be_script;
#[cfg(feature = "no_function")]
let native = true;
// Short-circuit native binary operator call if under Fast Operators mode
if operator_token.is_some() && self.fast_operators() && args.len() == 2 {
let mut lhs = self
@@ -257,8 +250,7 @@ impl Engine {
return self
.exec_fn_call(
None, global, caches, lib, name, native, *hashes, operands, false, false, pos,
level,
None, global, caches, lib, name, *hashes, operands, false, false, pos, level,
)
.map(|(v, ..)| v);
}
@@ -266,7 +258,7 @@ impl Engine {
#[cfg(not(feature = "no_module"))]
if !expr.namespace.is_empty() {
// Qualified function call
let hash = hashes.native;
let hash = hashes.native();
let namespace = &expr.namespace;
return self.make_qualified_function_call(
@@ -287,7 +279,6 @@ impl Engine {
lib,
this_ptr,
name,
native,
first_arg,
args,
*hashes,