Delay creation of global module until actually needed.

This commit is contained in:
Stephen Chung
2021-04-17 18:10:57 +08:00
parent 1be7e60be2
commit 9a8da93145
2 changed files with 9 additions and 5 deletions

View File

@@ -826,10 +826,6 @@ impl Engine {
lib: &[&Module],
level: usize,
) -> RhaiResult {
// Create the global module
#[cfg(not(feature = "no_function"))]
mods.push(crate::engine::KEYWORD_GLOBAL, Module::new());
self.eval_stmt_block(scope, mods, state, lib, &mut None, statements, false, level)
.or_else(|err| match *err {
EvalAltResult::Return(out, _) => Ok(out),