From e4db06cbdd436e2833bf072fa08a981dd3896c05 Mon Sep 17 00:00:00 2001 From: Brian Carroll Date: Mon, 18 Oct 2021 21:16:54 +0200 Subject: [PATCH] Add a debug assertion in code builder --- compiler/gen_wasm/src/code_builder.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/compiler/gen_wasm/src/code_builder.rs b/compiler/gen_wasm/src/code_builder.rs index 443ca79f17..74259b4677 100644 --- a/compiler/gen_wasm/src/code_builder.rs +++ b/compiler/gen_wasm/src/code_builder.rs @@ -127,14 +127,13 @@ impl CodeBuilder { match next_insertion { Some((&insert_pos, insert_inst)) if insert_pos == pos => { final_code.push(insert_inst.to_owned()); - final_code.push(instruction); next_insertion = insertions_iter.next(); } - _ => { - final_code.push(instruction); - } + _ => {} } + final_code.push(instruction); } + debug_assert!(next_insertion == None); } /// Total number of instructions in the final output