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

@ -402,7 +402,7 @@ pub unsafe extern "C" fn wasmer_export_func_call(
tag: wasmer_value_tag::WASM_F64,
value: wasmer_value { F64: x },
},
_ => panic!("not implemented"),
Value::V128(_) => unimplemented!("returning V128 type"),
};
results[0] = ret;
}

View File

@ -173,7 +173,7 @@ pub unsafe extern "C" fn wasmer_instance_call(
tag: wasmer_value_tag::WASM_F64,
value: wasmer_value { F64: x },
},
_ => panic!("not implemented"),
Value::V128(_) => unimplemented!("calling function with V128 parameter"),
};
results[0] = ret;
}

View File

@ -51,7 +51,7 @@ impl From<wasmer_value_t> for Value {
tag: wasmer_value_tag::WASM_F64,
value: wasmer_value { F64 },
} => Value::F64(F64),
_ => panic!("not implemented"),
_ => unreachable!("unknown WASM type"),
}
}
}
@ -76,7 +76,7 @@ impl From<Value> for wasmer_value_t {
tag: wasmer_value_tag::WASM_F64,
value: wasmer_value { F64: x },
},
_ => panic!("not implemented"),
Value::V128(_) => unimplemented!("V128 not supported in C API"),
}
}
}
@ -89,7 +89,7 @@ impl From<Type> for wasmer_value_tag {
Type::I64 => wasmer_value_tag::WASM_I64,
Type::F32 => wasmer_value_tag::WASM_F32,
Type::F64 => wasmer_value_tag::WASM_F64,
_ => panic!("not implemented"),
Type::V128 => unreachable!("V128 not supported in C API"),
}
}
}
@ -102,7 +102,7 @@ impl From<wasmer_value_tag> for Type {
wasmer_value_tag::WASM_I64 => Type::I64,
wasmer_value_tag::WASM_F32 => Type::F32,
wasmer_value_tag::WASM_F64 => Type::F64,
_ => panic!("not implemented"),
_ => unreachable!("unknown WASM type"),
}
}
}
@ -114,7 +114,7 @@ impl From<&wasmer_runtime::wasm::Type> for wasmer_value_tag {
Type::I64 => wasmer_value_tag::WASM_I64,
Type::F32 => wasmer_value_tag::WASM_F32,
Type::F64 => wasmer_value_tag::WASM_F64,
_ => panic!("not implemented"),
Type::V128 => unimplemented!("V128 not supported in C API"),
}
}
}