2020-02-26 13:07:31 -08:00
|
|
|
use crate::code::CodegenError;
|
2019-12-17 15:12:54 -08:00
|
|
|
use wasmer_runtime_core::parse::wp_type_to_type;
|
2019-05-06 23:41:31 -05:00
|
|
|
use wasmer_runtime_core::types::Type;
|
2020-02-26 13:07:31 -08:00
|
|
|
use wasmparser::TypeOrFuncType as WpTypeOrFuncType;
|
2019-07-01 16:11:38 -07:00
|
|
|
|
2020-02-26 13:07:31 -08:00
|
|
|
pub fn blocktype_to_type(ty: WpTypeOrFuncType) -> Result<Type, CodegenError> {
|
2019-07-01 16:11:38 -07:00
|
|
|
match ty {
|
2020-02-26 13:07:31 -08:00
|
|
|
WpTypeOrFuncType::Type(inner_ty) => Ok(wp_type_to_type(inner_ty)?),
|
2019-07-01 16:11:38 -07:00
|
|
|
_ => {
|
2020-02-26 13:07:31 -08:00
|
|
|
return Err(CodegenError {
|
2019-07-01 16:15:13 -07:00
|
|
|
message:
|
2020-02-26 13:07:31 -08:00
|
|
|
"the wasmer llvm backend does not yet support the multi-value return extension"
|
|
|
|
.to_string(),
|
2019-07-01 16:11:38 -07:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|