1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00

LibJS: Fix codegen for nodes after try statements without 'finally'

Previously we were just dropping them on the ground :P
This commit is contained in:
Ali Mohammad Pur 2021-11-10 22:22:26 +03:30 committed by Linus Groh
parent 5a38f86f1b
commit b96118b5d1
4 changed files with 43 additions and 2 deletions

View file

@ -446,6 +446,18 @@ void EnterUnwindContext::replace_references_impl(BasicBlock const& from, BasicBl
m_finalizer_target = Label { to };
}
void FinishUnwind::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.leave_unwind_context();
interpreter.jump(m_next_target);
}
void FinishUnwind::replace_references_impl(BasicBlock const& from, BasicBlock const& to)
{
if (&m_next_target.block() == &from)
m_next_target = Label { to };
}
void LeaveUnwindContext::execute_impl(Bytecode::Interpreter& interpreter) const
{
interpreter.leave_unwind_context();
@ -751,6 +763,11 @@ String EnterUnwindContext::to_string_impl(Bytecode::Executable const&) const
return String::formatted("EnterUnwindContext handler:{} finalizer:{} entry:{}", handler_string, finalizer_string, m_entry_point);
}
String FinishUnwind::to_string_impl(const Bytecode::Executable&) const
{
return String::formatted("FinishUnwind next:{}", m_next_target);
}
String LeaveUnwindContext::to_string_impl(Bytecode::Executable const&) const
{
return "LeaveUnwindContext";