summaryrefslogtreecommitdiff
path: root/crates/parser/src/module.rs
diff options
context:
space:
mode:
authorHenry <mail@henrygressmann.de>2026-04-03 21:30:45 +0200
committerHenry <mail@henrygressmann.de>2026-04-03 21:30:45 +0200
commita15acabfc1e23282d8fba9ec660f593b96709b2a (patch)
tree3f0485c1918bae84fc2f9b4c930cc5268f92aa5d /crates/parser/src/module.rs
parent303abc7ddaab670299e300b39b0c8f24a0aed139 (diff)
chore: cleanup
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'crates/parser/src/module.rs')
-rw-r--r--crates/parser/src/module.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/parser/src/module.rs b/crates/parser/src/module.rs
index a4afad0..27fcb1b 100644
--- a/crates/parser/src/module.rs
+++ b/crates/parser/src/module.rs
@@ -210,6 +210,12 @@ impl ModuleReader {
.map(|(func_idx, ((instructions, data, locals), ty_idx))| {
let ty = self.func_types.get(ty_idx as usize).expect("No func type for func, this is a bug").clone();
let params = ValueCountsSmall::from(&ty.params);
+ let locals = ValueCountsSmall {
+ c32: u16::try_from(locals.c32).unwrap_or_else(|_| unreachable!("local count exceeds u16")),
+ c64: u16::try_from(locals.c64).unwrap_or_else(|_| unreachable!("local count exceeds u16")),
+ c128: u16::try_from(locals.c128).unwrap_or_else(|_| unreachable!("local count exceeds u16")),
+ cref: u16::try_from(locals.cref).unwrap_or_else(|_| unreachable!("local count exceeds u16")),
+ };
let self_func_addr = imported_func_count + func_idx as u32;
let mut instructions = instructions.to_vec();
Self::apply_instruction_rewrites(&mut instructions, self_func_addr);