wasm: Make NameSection easier to manipulate

This commit is contained in:
Brian Carroll 2022-06-05 20:57:31 +02:00
parent 66c0c423b3
commit 376cbbc4b2
No known key found for this signature in database
GPG key ID: 5C7B2EC4101703C0
3 changed files with 48 additions and 46 deletions

View file

@ -137,7 +137,14 @@ fn compile_roc_to_wasm_bytes<'a, T: Wasm32Result>(
T::insert_wrapper(arena, &mut module, TEST_WRAPPER_NAME, main_fn_index);
// Export the initialiser function for refcount tests
let init_refcount_idx = module.names.functions[INIT_REFCOUNT_NAME];
let init_refcount_idx = module
.names
.function_names
.iter()
.filter(|(_, name)| *name == INIT_REFCOUNT_NAME)
.map(|(i, _)| *i)
.next()
.unwrap();
module.export.append(Export {
name: INIT_REFCOUNT_NAME,
ty: ExportType::Func,