From bca1f5300999d0c00268917d3156f34e7b717626 Mon Sep 17 00:00:00 2001 From: Haled Odat Date: Mon, 24 Apr 2023 07:24:40 +0200 Subject: [PATCH] Fix incorrect `LoopContinue` instruction in while-do loops --- boa_engine/src/bytecompiler/statement/loop.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boa_engine/src/bytecompiler/statement/loop.rs b/boa_engine/src/bytecompiler/statement/loop.rs index 785edceca70..ce05315ef0e 100644 --- a/boa_engine/src/bytecompiler/statement/loop.rs +++ b/boa_engine/src/bytecompiler/statement/loop.rs @@ -392,13 +392,13 @@ impl ByteCompiler<'_, '_> { let initial_label = self.jump(); let start_address = self.next_opcode_location(); - let (continue_start, continue_exit) = - self.emit_opcode_with_two_operands(Opcode::LoopContinue); - self.patch_jump_with_target(continue_start, start_address); self.patch_jump_with_target(loop_start, start_address); self.push_loop_control_info(label, start_address); let condition_label_address = self.next_opcode_location(); + let (continue_start, continue_exit) = + self.emit_opcode_with_two_operands(Opcode::LoopContinue); + self.patch_jump_with_target(continue_start, start_address); self.compile_expr(do_while_loop.cond(), true); let exit = self.jump_if_false();