diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index 565d8f347e..89aefe544f 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -1901,8 +1901,12 @@ Value TryStatement::execute(Interpreter& interpreter, GlobalObject& global_objec if (auto* exception = interpreter.exception()) { if (m_handler) { interpreter.vm().clear_exception(); - ArgumentVector arguments { { m_handler->parameter(), exception->value() } }; - interpreter.execute_statement(global_object, m_handler->body(), move(arguments)); + + HashMap parameters; + parameters.set(m_handler->parameter(), Variable { exception->value(), DeclarationKind::Var }); + auto* catch_scope = interpreter.heap().allocate(global_object, move(parameters), interpreter.vm().call_frame().scope); + TemporaryChange scope_change(interpreter.vm().call_frame().scope, catch_scope); + interpreter.execute_statement(global_object, m_handler->body()); } }