diff --git a/src/ast/expr.rs b/src/ast/expr.rs index b3b55aac..fed8d861 100644 --- a/src/ast/expr.rs +++ b/src/ast/expr.rs @@ -493,6 +493,7 @@ impl fmt::Debug for Expr { } } f.write_str(&x.3)?; + #[cfg(not(feature = "no_module"))] if let Some(n) = x.1.index() { write!(f, " #{}", n)?; } diff --git a/src/func/call.rs b/src/func/call.rs index ce83786f..64d8958c 100644 --- a/src/func/call.rs +++ b/src/func/call.rs @@ -1137,27 +1137,25 @@ impl Engine { KEYWORD_EVAL if total_args == 1 => { // eval - only in function call style let orig_scope_len = scope.len(); + #[cfg(not(feature = "no_module"))] let orig_imports_len = global.num_imports(); let arg = first_arg.unwrap(); let (arg_value, pos) = self.get_arg_value(scope, global, caches, lib, this_ptr, arg, level)?; - let script = &arg_value + let s = &arg_value .into_immutable_string() .map_err(|typ| self.make_type_mismatch_err::(typ, pos))?; - let result = self.eval_script_expr_in_place( - scope, - global, - caches, - lib, - script, - pos, - level + 1, - ); + let result = + self.eval_script_expr_in_place(scope, global, caches, lib, s, pos, level + 1); // IMPORTANT! If the eval defines new variables in the current scope, // all variable offsets from this point on will be mis-aligned. // The same is true for imports. - if scope.len() != orig_scope_len || global.num_imports() != orig_imports_len { + let scope_changed = scope.len() != orig_scope_len; + #[cfg(not(feature = "no_module"))] + let scope_changed = scope_changed || global.num_imports() != orig_imports_len; + + if scope_changed { global.always_search_scope = true; } diff --git a/src/func/callable_function.rs b/src/func/callable_function.rs index 3973b1b1..e6b85a29 100644 --- a/src/func/callable_function.rs +++ b/src/func/callable_function.rs @@ -199,7 +199,7 @@ impl CallableFunction { Self::Script(..) => None, } } - /// Create a new [`CallableFunction::Method`] from a [built-in function][`FnBuiltin`]. + /// Create a new [`CallableFunction::Method`] from a built-in function. #[inline(always)] #[must_use] pub fn from_fn_builtin(func: FnBuiltin) -> Self {