diff --git a/src/func/call.rs b/src/func/call.rs index 68c5c00b..e5fa0507 100644 --- a/src/func/call.rs +++ b/src/func/call.rs @@ -631,6 +631,7 @@ impl Engine { let hash = hashes.script(); let local_entry = &mut None; + #[cfg(not(feature = "no_object"))] let resolved = if _is_method_call && !args.is_empty() { let typed_hash = crate::calc_typed_method_hash(hash, self.map_type_name(args[0].type_name())); @@ -638,6 +639,8 @@ impl Engine { } else { None }; + #[cfg(feature = "no_object")] + let resolved = None; let resolved = if resolved.is_none() { self.resolve_fn(global, caches, local_entry, None, hash, None, false) diff --git a/src/lib.rs b/src/lib.rs index c184fbf6..8f4dda89 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -227,6 +227,7 @@ pub use api::{eval::eval, events::VarDefInfo, run::run}; pub use ast::{FnAccess, AST}; pub use engine::{Engine, OP_CONTAINS, OP_EQUALS}; pub use eval::EvalContext; +#[cfg(not(feature = "no_function"))] #[cfg(not(feature = "no_object"))] use func::calc_typed_method_hash; use func::{calc_fn_hash, calc_fn_hash_full, calc_var_hash}; diff --git a/src/module/mod.rs b/src/module/mod.rs index 84e1d7df..84b27c4b 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -2357,28 +2357,33 @@ impl Module { } functions.insert(hash_qualified_fn, f.func.clone()); - } else if cfg!(not(feature = "no_function")) { - let mut _hash_qualified_script = crate::calc_fn_hash( - path.iter().copied(), - &f.metadata.name, - f.metadata.num_params, - ); - #[cfg(not(feature = "no_object"))] - if let Some(ref this_type) = f.metadata.this_type { - _hash_qualified_script = - crate::calc_typed_method_hash(_hash_qualified_script, this_type); - } - - // Catch hash collisions in testing environment only. - #[cfg(feature = "testing-environ")] - if let Some(fx) = functions.get(&_hash_qualified_script) { - panic!( - "Hash {} already exists when indexing function {:#?}:\n{:#?}", - _hash_qualified_script, f.func, fx + } else { + #[cfg(not(feature = "no_function"))] + { + let hash_qualified_script = crate::calc_fn_hash( + path.iter().copied(), + &f.metadata.name, + f.metadata.num_params, ); - } + #[cfg(not(feature = "no_object"))] + let hash_qualified_script = + if let Some(ref this_type) = f.metadata.this_type { + crate::calc_typed_method_hash(hash_qualified_script, this_type) + } else { + hash_qualified_script + }; - functions.insert(_hash_qualified_script, f.func.clone()); + // Catch hash collisions in testing environment only. + #[cfg(feature = "testing-environ")] + if let Some(fx) = functions.get(&hash_qualified_script) { + panic!( + "Hash {} already exists when indexing function {:#?}:\n{:#?}", + hash_qualified_script, f.func, fx + ); + } + + functions.insert(hash_qualified_script, f.func.clone()); + } } }