From bc24765ba995a480287043a1f5b4563a26eb1969 Mon Sep 17 00:00:00 2001 From: Rerumu Date: Wed, 9 Feb 2022 05:27:38 -0500 Subject: [PATCH] Fix `gen_call_indirect` ordering --- wasm-ast/src/builder.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wasm-ast/src/builder.rs b/wasm-ast/src/builder.rs index 67cea14..de24da6 100644 --- a/wasm-ast/src/builder.rs +++ b/wasm-ast/src/builder.rs @@ -369,11 +369,10 @@ impl<'a> Builder<'a> { fn gen_call_indirect(&mut self, typ: u32, table: u8, stat: &mut Vec) { let arity = self.get_type_of(typ); + let index = self.data.pop(); 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 first = u32::try_from(len).unwrap(); let result = first..first + arity.num_result;