Save functions resolution cache during script call.
This commit is contained in:
parent
24ed5ef99a
commit
dff124b242
@ -392,10 +392,10 @@ impl Engine {
|
|||||||
|
|
||||||
// Merge in encapsulated environment, if any
|
// Merge in encapsulated environment, if any
|
||||||
let mut lib_merged: StaticVec<_>;
|
let mut lib_merged: StaticVec<_>;
|
||||||
|
let mut old_cache = None;
|
||||||
|
|
||||||
let unified_lib = if let Some(ref env_lib) = fn_def.lib {
|
let unified_lib = if let Some(ref env_lib) = fn_def.lib {
|
||||||
// If the library is modified, clear the functions lookup cache
|
old_cache = Some(mem::take(&mut state.functions_cache));
|
||||||
state.functions_cache.clear();
|
|
||||||
|
|
||||||
lib_merged = Default::default();
|
lib_merged = Default::default();
|
||||||
lib_merged.push(env_lib.as_ref());
|
lib_merged.push(env_lib.as_ref());
|
||||||
@ -467,6 +467,10 @@ impl Engine {
|
|||||||
mods.truncate(prev_mods_len);
|
mods.truncate(prev_mods_len);
|
||||||
state.scope_level = orig_scope_level;
|
state.scope_level = orig_scope_level;
|
||||||
|
|
||||||
|
if let Some(cache) = old_cache {
|
||||||
|
state.functions_cache = cache;
|
||||||
|
}
|
||||||
|
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user