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

@@ -1980,7 +1980,10 @@ impl Module {
// Save global state
let orig_imports_len = global.num_imports();
let orig_source = global.source.clone();
#[cfg(not(feature = "no_function"))]
let orig_lib_len = global.lib.len();
#[cfg(not(feature = "no_function"))]
let orig_constants = std::mem::take(&mut global.constants);
@@ -2008,8 +2011,12 @@ impl Module {
// Restore global state
#[cfg(not(feature = "no_function"))]
let constants = std::mem::replace(&mut global.constants, orig_constants);
global.truncate_imports(orig_imports_len);
#[cfg(not(feature = "no_function"))]
global.lib.truncate(orig_lib_len);
global.source = orig_source;
result?;