Use wasmi ValueType for RuntimeValue instead pwasm (#52)

`RuntimeValue::default` takes `parity_wasm::elements::ValueType` as an input parameter. 

This change fixes it to be wasmi's `ValueType`.
This commit is contained in:
Sergey Pepyakin 2018-02-14 13:36:17 +03:00 committed by GitHub
parent 4e8d113f84
commit 435bae5898
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -1101,6 +1101,7 @@ impl FunctionContext {
let locals = locals.iter() let locals = locals.iter()
.flat_map(|l| repeat(l.value_type()).take(l.count() as usize)) .flat_map(|l| repeat(l.value_type()).take(l.count() as usize))
.map(::types::ValueType::from_elements)
.map(RuntimeValue::default) .map(RuntimeValue::default)
.collect::<Vec<_>>(); .collect::<Vec<_>>();
self.locals.extend(locals); self.locals.extend(locals);

View File

@ -123,12 +123,12 @@ pub trait Float<T>: ArithmeticOps<T> {
impl RuntimeValue { impl RuntimeValue {
/// Creates new default value of given type. /// Creates new default value of given type.
pub fn default(value_type: ValueType) -> Self { pub fn default(value_type: ::types::ValueType) -> Self {
match value_type { match value_type {
ValueType::I32 => RuntimeValue::I32(0), ::types::ValueType::I32 => RuntimeValue::I32(0),
ValueType::I64 => RuntimeValue::I64(0), ::types::ValueType::I64 => RuntimeValue::I64(0),
ValueType::F32 => RuntimeValue::F32(0f32), ::types::ValueType::F32 => RuntimeValue::F32(0f32),
ValueType::F64 => RuntimeValue::F64(0f64), ::types::ValueType::F64 => RuntimeValue::F64(0f64),
} }
} }