mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibJS/Bytecode: Fix bogus program termination after try
with catch
For `try` statements with a `catch` clause, we were generating *two* "next" blocks. This meant that not throwing an exception would cause execution to stop. Fix this by using the "next" block pointer for the try "entry" and "handler" blocks.
This commit is contained in:
parent
b01fcccbbd
commit
81a62f4f59
Notes:
sideshowbarker
2024-07-17 22:01:16 +09:00
Author: https://github.com/awesomekling
Commit: 81a62f4f59
Pull-request: https://github.com/SerenityOS/serenity/pull/18818
1 changed files with 3 additions and 3 deletions
|
@ -2254,10 +2254,10 @@ Bytecode::CodeGenerationErrorOr<void> TryStatement::generate_bytecode(Bytecode::
|
|||
if (m_finalizer) {
|
||||
generator.emit<Bytecode::Op::Jump>(finalizer_target);
|
||||
} else {
|
||||
auto& block = generator.make_block();
|
||||
if (!next_block)
|
||||
next_block = &generator.make_block();
|
||||
generator.emit<Bytecode::Op::LeaveUnwindContext>();
|
||||
generator.emit<Bytecode::Op::Jump>(Bytecode::Label { block });
|
||||
next_block = █
|
||||
generator.emit<Bytecode::Op::Jump>(Bytecode::Label { *next_block });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue