Fix gen_call_indirect ordering

This commit is contained in:
Rerumu 2022-02-09 05:27:38 -05:00
parent d6b77b287e
commit bc24765ba9

View File

@ -369,11 +369,10 @@ impl<'a> Builder<'a> {
fn gen_call_indirect(&mut self, typ: u32, table: u8, stat: &mut Vec<Statement>) { fn gen_call_indirect(&mut self, typ: u32, table: u8, stat: &mut Vec<Statement>) {
let arity = self.get_type_of(typ); let arity = self.get_type_of(typ);
let index = self.data.pop();
let len = self.data.stack.len(); let len = self.data.stack.len();
let index = self.data.pop();
let param_list = self.data.stack.split_off(len - arity.num_param as usize); let param_list = self.data.stack.split_off(len - arity.num_param as usize);
let first = u32::try_from(len).unwrap(); let first = u32::try_from(len).unwrap();
let result = first..first + arity.num_result; let result = first..first + arity.num_result;