805: Replace panic! & unimplemented! in runtime-code and llvm-backend r=nlewycky a=pventuzelo

# Description

Replace `unimplemented!` by already used `CodegenError` in `lib/llvm-backend/src/code.rs`
Replace `unimplemented!` by `Err` in `lib/llvm-backend/src/trampolines.rs`
Replace `panic!` by already used `BinaryReaderError` in `lib/runtime-core/src/parse.rs`

# Review

- [ ] Create a short description of the the change in the CHANGELOG.md file


Co-authored-by: Patrick Ventuzelo <ventuzelo.patrick@gmail.com>
This commit is contained in:
bors[bot]
2019-09-19 19:20:04 +00:00
committed by GitHub
3 changed files with 45 additions and 18 deletions

View File

@ -392,14 +392,19 @@ pub fn read_module<
}
pub fn wp_type_to_type(ty: WpType) -> Result<Type, BinaryReaderError> {
Ok(match ty {
WpType::I32 => Type::I32,
WpType::I64 => Type::I64,
WpType::F32 => Type::F32,
WpType::F64 => Type::F64,
WpType::V128 => Type::V128,
_ => panic!("broken invariant, invalid type"),
})
match ty {
WpType::I32 => Ok(Type::I32),
WpType::I64 => Ok(Type::I64),
WpType::F32 => Ok(Type::F32),
WpType::F64 => Ok(Type::F64),
WpType::V128 => Ok(Type::V128),
_ => {
return Err(BinaryReaderError {
message: "broken invariant, invalid type",
offset: -1isize as usize,
});
}
}
}
pub fn type_to_wp_type(ty: Type) -> WpType {