mirror of
https://github.com/pezkuwichain/wasm-instrument.git
synced 2026-06-13 19:51:08 +00:00
Don't panic on missing import section
This commit is contained in:
+3
-2
@@ -48,7 +48,8 @@ pub fn externalize_mem(mut module: elements::Module, adjust_pages: Option<u32>,
|
|||||||
entry = elements::MemoryType::new(entry.limits().initial(), Some(max_pages));
|
entry = elements::MemoryType::new(entry.limits().initial(), Some(max_pages));
|
||||||
}
|
}
|
||||||
|
|
||||||
import_section(&mut module).expect("Import section to exist").entries_mut().push(
|
let mut builder = builder::from_module(module);
|
||||||
|
builder.push_import(
|
||||||
elements::ImportEntry::new(
|
elements::ImportEntry::new(
|
||||||
"env".to_owned(),
|
"env".to_owned(),
|
||||||
"memory".to_owned(),
|
"memory".to_owned(),
|
||||||
@@ -56,7 +57,7 @@ pub fn externalize_mem(mut module: elements::Module, adjust_pages: Option<u32>,
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
module
|
builder.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn foreach_public_func_name<F>(mut module: elements::Module, f: F) -> elements::Module
|
fn foreach_public_func_name<F>(mut module: elements::Module, f: F) -> elements::Module
|
||||||
|
|||||||
Reference in New Issue
Block a user