diff --git a/wasm-ast/src/factory.rs b/wasm-ast/src/factory.rs index 0742f7c..d4e3ee4 100644 --- a/wasm-ast/src/factory.rs +++ b/wasm-ast/src/factory.rs @@ -104,8 +104,8 @@ impl StatList { store_type, memory, offset, - value: self.stack.pop(), - pointer: self.stack.pop(), + value: self.stack.pop().into(), + pointer: self.stack.pop().into(), }); self.leak_memory_write(memory); @@ -312,7 +312,7 @@ impl<'a> Factory<'a> { let stat = match now.block_data { BlockData::Forward { .. } | BlockData::Backward { .. } => Statement::Block(now.into()), BlockData::If { .. } => Statement::If(If { - condition: self.target.stack.pop(), + condition: self.target.stack.pop().into(), on_true: now.into(), on_false: None, }), @@ -376,7 +376,7 @@ impl<'a> Factory<'a> { fn add_call_indirect(&mut self, ty: usize, table: usize) { let (num_param, num_result) = self.type_info.by_type_index(ty); - let index = self.target.stack.pop(); + let index = self.target.stack.pop().into(); let param_list = self.target.stack.pop_len(num_param).collect(); self.target.leak_pre_call(); @@ -458,7 +458,7 @@ impl<'a> Factory<'a> { Operator::BrIf { relative_depth } => { let target = relative_depth.try_into().unwrap(); let data = Statement::BrIf(BrIf { - condition: self.target.stack.pop(), + condition: self.target.stack.pop().into(), target: self.get_br_terminator(target), }); @@ -466,7 +466,7 @@ impl<'a> Factory<'a> { self.target.code.push(data); } Operator::BrTable { ref table } => { - let condition = self.target.stack.pop(); + let condition = self.target.stack.pop().into(); let data = table .targets() .map(Result::unwrap) @@ -532,7 +532,7 @@ impl<'a> Factory<'a> { let var = local_index.try_into().unwrap(); let data = Statement::SetLocal(SetLocal { var, - value: self.target.stack.pop(), + value: self.target.stack.pop().into(), }); self.target.leak_local_write(var); @@ -543,7 +543,7 @@ impl<'a> Factory<'a> { let get = Expression::GetLocal(GetLocal { var }); let set = Statement::SetLocal(SetLocal { var, - value: self.target.stack.pop(), + value: self.target.stack.pop().into(), }); self.target.leak_local_write(var); @@ -560,7 +560,7 @@ impl<'a> Factory<'a> { let var = global_index.try_into().unwrap(); let data = Statement::SetGlobal(SetGlobal { var, - value: self.target.stack.pop(), + value: self.target.stack.pop().into(), }); self.target.leak_global_write(var); diff --git a/wasm-ast/src/node.rs b/wasm-ast/src/node.rs index 98a85e9..dba1975 100644 --- a/wasm-ast/src/node.rs +++ b/wasm-ast/src/node.rs @@ -849,7 +849,7 @@ impl Br { } pub struct BrTable { - pub(crate) condition: Expression, + pub(crate) condition: Box, pub(crate) data: Vec
, pub(crate) default: Br, } @@ -908,7 +908,7 @@ impl Block { } pub struct BrIf { - pub(crate) condition: Expression, + pub(crate) condition: Box, pub(crate) target: Br, } @@ -925,7 +925,7 @@ impl BrIf { } pub struct If { - pub(crate) condition: Expression, + pub(crate) condition: Box, pub(crate) on_true: Block, pub(crate) on_false: Option, } @@ -972,7 +972,7 @@ impl Call { pub struct CallIndirect { pub(crate) table: usize, - pub(crate) index: Expression, + pub(crate) index: Box, pub(crate) result: Range, pub(crate) param_list: Vec, } @@ -1001,7 +1001,7 @@ impl CallIndirect { pub struct SetTemporary { pub(crate) var: usize, - pub(crate) value: Expression, + pub(crate) value: Box, } impl SetTemporary { @@ -1018,7 +1018,7 @@ impl SetTemporary { pub struct SetLocal { pub(crate) var: usize, - pub(crate) value: Expression, + pub(crate) value: Box, } impl SetLocal { @@ -1035,7 +1035,7 @@ impl SetLocal { pub struct SetGlobal { pub(crate) var: usize, - pub(crate) value: Expression, + pub(crate) value: Box, } impl SetGlobal { @@ -1054,8 +1054,8 @@ pub struct StoreAt { pub(crate) store_type: StoreType, pub(crate) memory: usize, pub(crate) offset: u32, - pub(crate) pointer: Expression, - pub(crate) value: Expression, + pub(crate) pointer: Box, + pub(crate) value: Box, } impl StoreAt { diff --git a/wasm-ast/src/stack.rs b/wasm-ast/src/stack.rs index dfe97f1..1d79857 100644 --- a/wasm-ast/src/stack.rs +++ b/wasm-ast/src/stack.rs @@ -139,7 +139,7 @@ impl Stack { let get = Expression::GetTemporary(GetTemporary { var }); let set = Statement::SetTemporary(SetTemporary { var, - value: std::mem::replace(&mut old.data, get), + value: std::mem::replace(&mut old.data, get).into(), }); self.capacity = self.capacity.max(var + 1);