Improve panic/unreachable/unimplemented usage. Refactor a little.

This commit is contained in:
Nick Lewycky
2019-07-22 12:15:56 -07:00
parent 4535274cf3
commit 18307bb79c
7 changed files with 21 additions and 35 deletions

View File

@ -618,7 +618,7 @@ fn call_func_with_index(
Type::I64 => Value::I64(raw as i64),
Type::F32 => Value::F32(f32::from_bits(raw as u32)),
Type::F64 => Value::F64(f64::from_bits(raw)),
_ => unreachable!(),
Type::V128 => unreachable!("V128 does not map to any single value"),
};
match signature.returns() {

View File

@ -83,9 +83,10 @@ impl Instance for LocalInstance {
match args_u64.len() {
0 => (transmute::<_, extern "C" fn() -> u128>(addr))(),
1 => (transmute::<_, extern "C" fn(u64) -> u128>(addr))(args_u64[0]),
2 => {
(transmute::<_, extern "C" fn(u64, u64) -> u128>(addr))(args_u64[0], args_u64[1])
}
2 => (transmute::<_, extern "C" fn(u64, u64) -> u128>(addr))(
args_u64[0],
args_u64[1],
),
3 => (transmute::<_, extern "C" fn(u64, u64, u64) -> u128>(addr))(
args_u64[0],
args_u64[1],