Prevent spill-over of new variables in Engine::call_fn.
This commit is contained in:
parent
b6eac65601
commit
58352e00bd
@ -8,6 +8,7 @@ Bug fixes
|
||||
---------
|
||||
|
||||
* Custom syntax starting with a disabled standard keyword now works properly.
|
||||
* When calling `Engine::call_fn`, new variables defined during evaluation of the body script are removed and no longer spill into the function call.
|
||||
|
||||
Enhancements
|
||||
------------
|
||||
|
@ -1979,7 +1979,10 @@ impl Engine {
|
||||
let statements = ast.statements();
|
||||
|
||||
if eval_ast && !statements.is_empty() {
|
||||
// Make sure new variables introduced at global level do not _spill_ into the function call
|
||||
let orig_scope_len = scope.len();
|
||||
self.eval_global_statements(scope, mods, state, statements, lib, 0)?;
|
||||
scope.rewind(orig_scope_len);
|
||||
}
|
||||
|
||||
let fn_def = ast
|
||||
|
Loading…
Reference in New Issue
Block a user