Upgrade wasmparser to 0.58.0 (#1942)

* Upgrade wasmparser to 0.58.0

* Enable more spec tests
This commit is contained in:
Andrew Brown
2020-06-30 09:08:21 -07:00
committed by GitHub
parent 43f8453b34
commit 4d57ae99e3
15 changed files with 74 additions and 47 deletions

View File

@@ -24,7 +24,7 @@ smallvec = "1.0.0"
staticvec = "0.10"
thiserror = "1.0.9"
typemap = "0.3"
wasmparser = "0.57.0"
wasmparser = "0.58.0"
[dev-dependencies]
lazy_static = "1.2"

View File

@@ -5,14 +5,18 @@ use cranelift_codegen::{binemit, ir};
use wasmparser::{
CodeSectionReader, DataSectionReader, ElementSectionReader, ExportSectionReader, FuncType,
FunctionSectionReader, GlobalSectionReader, ImportSectionReader, MemorySectionReader,
MemoryType, TableSectionReader, TableType, TypeSectionReader,
MemoryType, TableSectionReader, TableType, TypeDef, TypeSectionReader,
};
/// Parses the Type section of the wasm module.
pub fn type_(types_reader: TypeSectionReader) -> Result<Vec<FuncType>, Error> {
types_reader
.into_iter()
.map(|r| r.map_err(Into::into))
.map(|r| match r {
Ok(TypeDef::Func(ft)) => Ok(ft),
Ok(_) => unimplemented!("module linking is not implemented yet"),
Err(e) => Err(e.into()),
})
.collect()
}