diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index 54ebd19c2a..c553fbcca5 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -41,6 +41,8 @@ Value Interpreter::run(Executable const& executable) TemporaryChange restore_executable { m_current_executable, &executable }; + vm().set_last_value(Badge {}, {}); + CallFrame global_call_frame; if (vm().call_stack().is_empty()) { global_call_frame.this_value = &global_object(); @@ -102,6 +104,8 @@ Value Interpreter::run(Executable const& executable) } } + vm().set_last_value(Badge {}, accumulator()); + m_register_windows.take_last(); auto return_value = m_return_value.value_or(js_undefined()); diff --git a/Userland/Libraries/LibJS/Interpreter.cpp b/Userland/Libraries/LibJS/Interpreter.cpp index 90f4584948..db06157740 100644 --- a/Userland/Libraries/LibJS/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Interpreter.cpp @@ -43,7 +43,7 @@ void Interpreter::run(GlobalObject& global_object, const Program& program) VM::InterpreterExecutionScope scope(*this); - vm.set_last_value({}, {}); + vm.set_last_value(Badge {}, {}); CallFrame global_call_frame; global_call_frame.current_node = &program; @@ -56,7 +56,7 @@ void Interpreter::run(GlobalObject& global_object, const Program& program) vm.push_call_frame(global_call_frame, global_object); VERIFY(!vm.exception()); auto value = program.execute(*this, global_object); - vm.set_last_value({}, value.value_or(js_undefined())); + vm.set_last_value(Badge {}, value.value_or(js_undefined())); vm.pop_call_frame(); diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index b74126bf3d..f897b4a9dd 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -158,6 +158,7 @@ public: } Value last_value() const { return m_last_value; } + void set_last_value(Badge, Value value) { m_last_value = value; } void set_last_value(Badge, Value value) { m_last_value = value; } const StackInfo& stack_info() const { return m_stack_info; };