mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibJS/Bytecode: Don't begin breakable scope before variable scope in for
This is no longer required, since the variable scope is ended after switching to the end block, which means that LeaveLexicalEnvironment will always be generated instead of depending on the unwind mechanism to handle it for us.
This commit is contained in:
parent
3a48c7fdaf
commit
896c477107
Notes:
sideshowbarker
2024-07-17 08:50:44 +09:00
Author: https://github.com/Lubrsi
Commit: 896c477107
Pull-request: https://github.com/SerenityOS/serenity/pull/14614
Reviewed-by: https://github.com/linusg ✅
1 changed files with 2 additions and 4 deletions
|
@ -827,9 +827,6 @@ Bytecode::CodeGenerationErrorOr<void> ForStatement::generate_labelled_evaluation
|
|||
|
||||
bool has_lexical_environment = false;
|
||||
|
||||
// The breakable scope needs to start here to unwind the potentially created lexical environment for the init bytecode.
|
||||
generator.begin_breakable_scope(Bytecode::Label { end_block }, label_set);
|
||||
|
||||
if (m_init) {
|
||||
if (m_init->is_variable_declaration()) {
|
||||
auto& variable_declaration = verify_cast<VariableDeclaration>(*m_init);
|
||||
|
@ -882,7 +879,9 @@ Bytecode::CodeGenerationErrorOr<void> ForStatement::generate_labelled_evaluation
|
|||
|
||||
generator.switch_to_basic_block(*body_block_ptr);
|
||||
generator.begin_continuable_scope(Bytecode::Label { *update_block_ptr }, label_set);
|
||||
generator.begin_breakable_scope(Bytecode::Label { end_block }, label_set);
|
||||
TRY(m_body->generate_bytecode(generator));
|
||||
generator.end_breakable_scope();
|
||||
generator.end_continuable_scope();
|
||||
|
||||
if (!generator.is_current_block_terminated()) {
|
||||
|
@ -906,7 +905,6 @@ Bytecode::CodeGenerationErrorOr<void> ForStatement::generate_labelled_evaluation
|
|||
if (has_lexical_environment)
|
||||
generator.end_variable_scope();
|
||||
|
||||
generator.end_breakable_scope();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue