diff options
Diffstat (limited to 'crates/parser')
| -rw-r--r-- | crates/parser/Cargo.toml | 4 | ||||
| -rw-r--r-- | crates/parser/src/lib.rs | 22 |
2 files changed, 10 insertions, 16 deletions
diff --git a/crates/parser/Cargo.toml b/crates/parser/Cargo.toml index 1592f85..df8acce 100644 --- a/crates/parser/Cargo.toml +++ b/crates/parser/Cargo.toml @@ -11,9 +11,9 @@ repository.workspace=true # fork of wasmparser with no_std support, see https://github.com/bytecodealliance/wasmtime/issues/3495 wasmparser={version="0.100", package="wasmparser-nostd", default-features=false} log={version="0.4", optional=true} -tinywasm-types={version="0.3.0-alpha.0", path="../types"} +tinywasm-types={version="0.3.0-alpha.0", path="../types", default-features=false} [features] default=["std", "logging"] logging=["log"] -std=[] +std=["tinywasm-types/std"] diff --git a/crates/parser/src/lib.rs b/crates/parser/src/lib.rs index edcd280..c608232 100644 --- a/crates/parser/src/lib.rs +++ b/crates/parser/src/lib.rs @@ -25,7 +25,7 @@ mod module; use alloc::{string::ToString, vec::Vec}; pub use error::*; use module::ModuleReader; -use tinywasm_types::WasmFunction; +use tinywasm_types::{TypedWasmFunction, WasmFunction}; use wasmparser::Validator; pub use tinywasm_types::TinyWasmModule; @@ -116,19 +116,13 @@ impl TryFrom<ModuleReader> for TinyWasmModule { .code .into_iter() .zip(code_type_addrs) - .map(|(f, ty_idx)| { - ( - ty_idx, - WasmFunction { - instructions: f.body, - locals: f.locals, - ty: reader - .func_types - .get(ty_idx as usize) - .expect("No func type for func, this is a bug") - .clone(), - }, - ) + .map(|(f, ty_idx)| TypedWasmFunction { + type_addr: ty_idx, + wasm_function: WasmFunction { + instructions: f.body, + locals: f.locals, + ty: reader.func_types.get(ty_idx as usize).expect("No func type for func, this is a bug").clone(), + }, }) .collect::<Vec<_>>(); |
