Minor code restructure.

This commit is contained in:
Stephen Chung
2022-10-16 11:35:21 +08:00
parent 45f0fdcbe0
commit 530109275f
6 changed files with 137 additions and 112 deletions

View File

@@ -175,21 +175,26 @@ fn has_native_fn_override(
// First check the global namespace and packages, but skip modules that are standard because
// they should never conflict with system functions.
let result = engine
if engine
.global_modules
.iter()
.filter(|m| !m.standard)
.any(|m| m.contains_fn(hash));
.any(|m| m.contains_fn(hash))
{
return true;
}
#[cfg(not(feature = "no_module"))]
// Then check sub-modules
let result = result
|| engine
.global_sub_modules
.values()
.any(|m| m.contains_qualified_fn(hash));
#[cfg(not(feature = "no_module"))]
if engine
.global_sub_modules
.values()
.any(|m| m.contains_qualified_fn(hash))
{
return true;
}
result
false
}
/// Optimize a block of [statements][Stmt].