From 375f9aa32b117a42c7a9c7f29d3c592b81d966be Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Tue, 19 Dec 2023 14:37:51 +0100 Subject: feat: parse memory and table sections Signed-off-by: Henry Gressmann --- crates/parser/src/lib.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'crates/parser/src/lib.rs') diff --git a/crates/parser/src/lib.rs b/crates/parser/src/lib.rs index bcaef76..36deb7f 100644 --- a/crates/parser/src/lib.rs +++ b/crates/parser/src/lib.rs @@ -102,9 +102,9 @@ impl TryFrom for TinyWasmModule { return Err(ParseError::EndNotReached); } - let func_types = reader.function_section; + let func_types = reader.func_addrs; let funcs = reader - .code_section + .code .into_iter() .zip(func_types) .map(|(f, ty)| Function { @@ -114,15 +114,18 @@ impl TryFrom for TinyWasmModule { }) .collect::>(); - let globals = reader.global_section; + let globals = reader.globals; + let table_types = reader.table_types; Ok(TinyWasmModule { version: reader.version, start_func: reader.start_func, - types: reader.type_section.into_boxed_slice(), + func_types: reader.func_types.into_boxed_slice(), funcs: funcs.into_boxed_slice(), - exports: reader.export_section.into_boxed_slice(), + exports: reader.exports.into_boxed_slice(), globals: globals.into_boxed_slice(), + table_types: table_types.into_boxed_slice(), + memory_types: reader.memory_types.into_boxed_slice(), }) } } -- cgit v1.3.1