Simplify code by merging Engine::global_namespace with Engine::global_modules.

This commit is contained in:
Stephen Chung
2021-08-30 10:09:28 +08:00
parent 6f3de4c803
commit 6faa6358f0
4 changed files with 23 additions and 27 deletions

View File

@@ -148,10 +148,8 @@ impl<'a> OptimizerState<'a> {
let hash_params = calc_fn_params_hash(arg_types.iter().cloned());
let hash = combine_hashes(hash_script, hash_params);
// First check registered functions
self.engine.global_namespace.contains_fn(hash)
// Then check packages
|| self.engine.global_modules.iter().any(|m| m.contains_fn(hash))
// First check packages
self.engine.global_modules.iter().any(|m| m.contains_fn(hash))
// Then check sub-modules
|| self.engine.global_sub_modules.values().any(|m| m.contains_qualified_fn(hash))
}