From ffb1e095fc1d6a2d54cc7637797c625dee6ebe6a Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Wed, 29 May 2024 01:39:21 +0200 Subject: chore: update deps, cleanup Signed-off-by: Henry Gressmann --- crates/parser/src/module.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'crates/parser/src/module.rs') diff --git a/crates/parser/src/module.rs b/crates/parser/src/module.rs index a4bdba4..294782c 100644 --- a/crates/parser/src/module.rs +++ b/crates/parser/src/module.rs @@ -179,14 +179,12 @@ impl ModuleReader { } #[inline] - pub(crate) fn to_module(self) -> Result { + pub(crate) fn into_module(self) -> Result { if !self.end_reached { return Err(ParseError::EndNotReached); } - let local_function_count = self.code.len(); - - if self.code_type_addrs.len() != local_function_count { + if self.code_type_addrs.len() != self.code.len() { return Err(ParseError::Other("Code and code type address count mismatch".to_string())); } @@ -199,13 +197,14 @@ impl ModuleReader { locals, ty: self.func_types.get(ty_idx as usize).expect("No func type for func, this is a bug").clone(), }) - .collect::>(); + .collect::>() + .into_boxed_slice(); let globals = self.globals; let table_types = self.table_types; Ok(TinyWasmModule { - funcs: funcs.into_boxed_slice(), + funcs, func_types: self.func_types.into_boxed_slice(), globals: globals.into_boxed_slice(), table_types: table_types.into_boxed_slice(), -- cgit v1.3.1