bytecodealliance / wasm-tools

CLI and Rust libraries for low-level manipulation of WebAssembly modules
Apache License 2.0
1.3k stars 234 forks source link

Simplify and clarify some value type parsing #1601

Closed alexcrichton closed 3 months ago

alexcrichton commented 3 months ago

Reading over #1600 I remembered that I have a difficult time understanding how value types are encoded in wasm. There's a number of overlapping concerns and a bit of duplication within wasmparser itself. I've tried to leave an explanatory comment for myself in the future which can also hopefully help serve others as well.

Along the way I've also managed to remove ValType::is_valtype_byte with some simpler logic to avoid duplication of all the value type bytes that are supported.