diff options
| author | Henry <mail@henrygressmann.de> | 2026-05-02 21:14:02 +0200 |
|---|---|---|
| committer | Henry <mail@henrygressmann.de> | 2026-05-02 21:19:54 +0200 |
| commit | ba1cf56464f8e5c3c7bcc2dc75f10aad2cd56e6b (patch) | |
| tree | dd0bef203b31c494f48e72c1169f2f50ae7b6d21 /crates/parser/src/module.rs | |
| parent | d3c6b705a3b1035adda66a92131e9ddf59fb46ab (diff) | |
chore: add more tests, fix issues with import types, cleanup doom example
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'crates/parser/src/module.rs')
| -rw-r--r-- | crates/parser/src/module.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/parser/src/module.rs b/crates/parser/src/module.rs index 02a3297..5f5e5e2 100644 --- a/crates/parser/src/module.rs +++ b/crates/parser/src/module.rs @@ -377,6 +377,15 @@ impl<'a> ModuleReader<'a> { }; let mut funcs = Vec::with_capacity(self.code.len()); + let mut func_type_idxs = self + .imports + .iter() + .filter_map(|import| match import.kind { + ImportKind::Function(type_idx) => Some(type_idx), + _ => None, + }) + .collect::<Vec<_>>(); + func_type_idxs.extend(self.code_type_addrs.iter().copied()); for (code, ty_idx) in self.code.into_iter().zip(self.code_type_addrs) { let ty = self.func_types.get(ty_idx as usize).expect("No func type for func, this is a bug").clone(); @@ -402,6 +411,7 @@ impl<'a> ModuleReader<'a> { Ok(ModuleInner { funcs: funcs.into(), func_types: self.func_types.into(), + func_type_idxs: func_type_idxs.into(), globals: self.globals.into(), table_types: self.table_types.into(), imports: self.imports.into(), |
