Always search scope after scope is modified.

This commit is contained in:
Stephen Chung
2023-01-27 22:31:14 +08:00
parent 733bb07d2d
commit f4949a2beb
3 changed files with 27 additions and 4 deletions

View File

@@ -728,10 +728,17 @@ impl Engine {
nesting_level: global.scope_level,
will_shadow,
};
let orig_scope_len = scope.len();
let context =
EvalContext::new(self, global, caches, scope, this_ptr.as_deref_mut());
let filter_result = filter(true, info, context);
if !filter(true, info, context)? {
if orig_scope_len != scope.len() {
// The scope is changed, always search from now on
global.always_search_scope = true;
}
if !filter_result? {
return Err(ERR::ErrorForbiddenVariable(var_name.to_string(), *pos).into());
}
}