mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibJS/Bytecode: End for's variable scope after update block generation
The update block can generate bytecode that refers to the lexical environment, so we have to end the scope after it has been generated. Previously the Jump to the update block would terminate the block, causing us to leave the lexical environment just before jumping to the update block.
This commit is contained in:
parent
1fc6bbcdc3
commit
515f3e0b85
Notes:
sideshowbarker
2024-07-17 17:24:32 +09:00
Author: https://github.com/Lubrsi
Commit: 515f3e0b85
Pull-request: https://github.com/SerenityOS/serenity/pull/13053
1 changed files with 3 additions and 3 deletions
|
@ -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 {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue