LibJS/Bytecode: Put end block last in for statement codegen

This commit is contained in:
Andreas Kling
2024-05-06 10:10:38 +02:00
parent f3d57db774
commit 95759dcc6d

View File

@@ -851,8 +851,6 @@ Bytecode::CodeGenerationErrorOr<Optional<Bytecode::Operand>> 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<Optional<Bytecode::Operand>> ForStatement::gener
else
test_block_ptr = body_block_ptr;
auto& end_block = generator.make_block();
generator.emit<Bytecode::Op::Jump>(Bytecode::Label { *test_block_ptr });
if (m_test) {