summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp
index cd2ac0f7a4..03c4fc0900 100644
--- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp
@@ -782,9 +782,6 @@ Bytecode::CodeGenerationErrorOr<void> ForStatement::generate_bytecode(Bytecode::
generator.end_breakable_scope();
generator.end_continuable_scope();
- if (has_lexical_environment)
- generator.end_variable_scope();
-
if (!generator.is_current_block_terminated()) {
if (m_update) {
generator.emit<Bytecode::Op::Jump>().set_targets(
@@ -803,6 +800,9 @@ Bytecode::CodeGenerationErrorOr<void> ForStatement::generate_bytecode(Bytecode::
generator.emit<Bytecode::Op::Load>(result_reg);
}
+ if (has_lexical_environment)
+ generator.end_variable_scope();
+
return {};
}