1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 22:08:12 +00:00

LibJS: Generate unwind chains for continue in Bytecode

This works similar to `break`
The `try-finally-continue` still do not pass with this, likely because
of binding issues.
This commit is contained in:
Hendiadyoin1 2022-11-25 16:35:39 +01:00 committed by Linus Groh
parent f5376cb282
commit d65488b80c
4 changed files with 55 additions and 19 deletions

View file

@ -1972,17 +1972,11 @@ Bytecode::CodeGenerationErrorOr<void> ContinueStatement::generate_bytecode(Bytec
// We need to execute the finally block, but tell it to resume
// execution at the designated block
if (m_target_label.is_null()) {
generator.perform_needed_unwinds<Bytecode::Op::Jump>();
generator.emit<Bytecode::Op::Jump>().set_targets(
generator.nearest_continuable_scope(),
{});
generator.generate_continue();
return {};
}
auto target_to_jump_to = generator.perform_needed_unwinds_for_labelled_continue_and_return_target_block(m_target_label);
generator.emit<Bytecode::Op::Jump>().set_targets(
target_to_jump_to,
{});
generator.generate_continue(m_target_label);
return {};
}