This commit is contained in:
Stephen Chung
2022-11-10 14:25:48 +08:00
parent 54353c6676
commit 013ee223ee
10 changed files with 87 additions and 43 deletions

View File

@@ -207,6 +207,8 @@ impl Engine {
ast: &'a AST,
) -> RhaiResult {
let orig_source = mem::replace(&mut global.source, ast.source_raw().cloned());
#[cfg(not(feature = "no_function"))]
let orig_lib_len = global.lib.len();
#[cfg(not(feature = "no_function"))]
@@ -242,7 +244,9 @@ impl Engine {
global.embedded_module_resolver = orig_embedded_module_resolver;
}
#[cfg(not(feature = "no_function"))]
global.lib.truncate(orig_lib_len);
global.source = orig_source;
result