Update for new wasmparser.rs version.

This commit is contained in:
Nick Lewycky
2019-07-01 16:11:38 -07:00
parent 35c2325571
commit 9fc713f9b1
3 changed files with 27 additions and 12 deletions

View File

@ -1,5 +1,5 @@
use wasmer_runtime_core::types::Type;
use wasmparser::{BinaryReaderError, Type as WpType};
use wasmparser::{BinaryReaderError, Type as WpType, TypeOrFuncType as WpTypeOrFuncType};
pub fn type_to_type(ty: WpType) -> Result<Type, BinaryReaderError> {
Ok(match ty {
@ -21,3 +21,15 @@ pub fn type_to_type(ty: WpType) -> Result<Type, BinaryReaderError> {
}
})
}
pub fn blocktype_to_type(ty: WpTypeOrFuncType) -> Result<Type, BinaryReaderError> {
match ty {
WpTypeOrFuncType::Type(inner_ty) => { type_to_type(inner_ty) }
_ => {
return Err(BinaryReaderError {
message: "the wasmer llvm backend does not yet support the multi-value return extension",
offset: -1isize as usize,
});
}
}
}