Fix builds.

This commit is contained in:
Stephen Chung 2023-03-22 16:16:33 +08:00
parent e60d0fc0bc
commit 9d4972f6d3
3 changed files with 29 additions and 20 deletions

View File

@ -631,6 +631,7 @@ impl Engine {
let hash = hashes.script(); let hash = hashes.script();
let local_entry = &mut None; let local_entry = &mut None;
#[cfg(not(feature = "no_object"))]
let resolved = if _is_method_call && !args.is_empty() { let resolved = if _is_method_call && !args.is_empty() {
let typed_hash = let typed_hash =
crate::calc_typed_method_hash(hash, self.map_type_name(args[0].type_name())); crate::calc_typed_method_hash(hash, self.map_type_name(args[0].type_name()));
@ -638,6 +639,8 @@ impl Engine {
} else { } else {
None None
}; };
#[cfg(feature = "no_object")]
let resolved = None;
let resolved = if resolved.is_none() { let resolved = if resolved.is_none() {
self.resolve_fn(global, caches, local_entry, None, hash, None, false) self.resolve_fn(global, caches, local_entry, None, hash, None, false)

View File

@ -227,6 +227,7 @@ pub use api::{eval::eval, events::VarDefInfo, run::run};
pub use ast::{FnAccess, AST}; pub use ast::{FnAccess, AST};
pub use engine::{Engine, OP_CONTAINS, OP_EQUALS}; pub use engine::{Engine, OP_CONTAINS, OP_EQUALS};
pub use eval::EvalContext; pub use eval::EvalContext;
#[cfg(not(feature = "no_function"))]
#[cfg(not(feature = "no_object"))] #[cfg(not(feature = "no_object"))]
use func::calc_typed_method_hash; use func::calc_typed_method_hash;
use func::{calc_fn_hash, calc_fn_hash_full, calc_var_hash}; use func::{calc_fn_hash, calc_fn_hash_full, calc_var_hash};

View File

@ -2357,28 +2357,33 @@ impl Module {
} }
functions.insert(hash_qualified_fn, f.func.clone()); functions.insert(hash_qualified_fn, f.func.clone());
} else if cfg!(not(feature = "no_function")) { } else {
let mut _hash_qualified_script = crate::calc_fn_hash( #[cfg(not(feature = "no_function"))]
{
let hash_qualified_script = crate::calc_fn_hash(
path.iter().copied(), path.iter().copied(),
&f.metadata.name, &f.metadata.name,
f.metadata.num_params, f.metadata.num_params,
); );
#[cfg(not(feature = "no_object"))] #[cfg(not(feature = "no_object"))]
let hash_qualified_script =
if let Some(ref this_type) = f.metadata.this_type { if let Some(ref this_type) = f.metadata.this_type {
_hash_qualified_script = crate::calc_typed_method_hash(hash_qualified_script, this_type)
crate::calc_typed_method_hash(_hash_qualified_script, this_type); } else {
} hash_qualified_script
};
// Catch hash collisions in testing environment only. // Catch hash collisions in testing environment only.
#[cfg(feature = "testing-environ")] #[cfg(feature = "testing-environ")]
if let Some(fx) = functions.get(&_hash_qualified_script) { if let Some(fx) = functions.get(&hash_qualified_script) {
panic!( panic!(
"Hash {} already exists when indexing function {:#?}:\n{:#?}", "Hash {} already exists when indexing function {:#?}:\n{:#?}",
_hash_qualified_script, f.func, fx hash_qualified_script, f.func, fx
); );
} }
functions.insert(_hash_qualified_script, f.func.clone()); functions.insert(hash_qualified_script, f.func.clone());
}
} }
} }