From 95759dcc6d47ebc4ea4ec88259c6f2af37c4793c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 6 May 2024 10:10:38 +0200 Subject: [PATCH] LibJS/Bytecode: Put end block last in `for` statement codegen --- Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index 9c44e22e15..a172a8b754 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -851,8 +851,6 @@ Bytecode::CodeGenerationErrorOr> ForStatement::gener Bytecode::BasicBlock* body_block_ptr { nullptr }; Bytecode::BasicBlock* update_block_ptr { nullptr }; - auto& end_block = generator.make_block(); - bool has_lexical_environment = false; if (m_init) { @@ -897,6 +895,8 @@ Bytecode::CodeGenerationErrorOr> ForStatement::gener else test_block_ptr = body_block_ptr; + auto& end_block = generator.make_block(); + generator.emit(Bytecode::Label { *test_block_ptr }); if (m_test) {