diff --git a/Userland/Libraries/LibJS/Bytecode/BasicBlock.h b/Userland/Libraries/LibJS/Bytecode/BasicBlock.h index 76533d67d5..fe046434a5 100644 --- a/Userland/Libraries/LibJS/Bytecode/BasicBlock.h +++ b/Userland/Libraries/LibJS/Bytecode/BasicBlock.h @@ -9,6 +9,7 @@ #include #include #include +#include namespace JS::Bytecode { @@ -16,6 +17,9 @@ struct UnwindInfo { Executable const* executable; BasicBlock const* handler; BasicBlock const* finalizer; + + Handle lexical_environment; + Handle variable_environment; }; class BasicBlock { diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index 44d21b75bf..c6dfb3aa48 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -91,6 +91,8 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e if (unwind_context.executable != m_current_executable) break; if (unwind_context.handler) { + vm().running_execution_context().lexical_environment = unwind_context.lexical_environment; + vm().running_execution_context().variable_environment = unwind_context.variable_environment; m_current_block = unwind_context.handler; unwind_context.handler = nullptr; @@ -205,7 +207,12 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e void Interpreter::enter_unwind_context(Optional