Fix encapsulated environment in module functions.
This commit is contained in:
@@ -646,13 +646,12 @@ impl Engine {
|
||||
};
|
||||
|
||||
mem::swap(&mut global.source, &mut source);
|
||||
let level = _level + 1;
|
||||
|
||||
let result = if _is_method_call {
|
||||
// Method call of script function - map first argument to `this`
|
||||
let (first_arg, rest_args) = args.split_first_mut().unwrap();
|
||||
|
||||
let level = _level + 1;
|
||||
|
||||
let result = self.call_script_fn(
|
||||
scope,
|
||||
global,
|
||||
@@ -679,8 +678,6 @@ impl Engine {
|
||||
.change_first_arg_to_copy(args);
|
||||
}
|
||||
|
||||
let level = _level + 1;
|
||||
|
||||
let result = self.call_script_fn(
|
||||
scope, global, state, lib, &mut None, func, args, pos, true, level,
|
||||
);
|
||||
|
Reference in New Issue
Block a user