ladybird/Libraries/LibJS/Runtime/DisposableStack.cpp
Timothy Flynn 5ea0aa5f08 LibJS: Bring the explicit resource management implementation up to date
While we don't yet have a working `using` implementation with our byte
code, we can still keep our DisposableStack implementation up to date.
The changes brought in here are all editorial, and set us up to start
an AsyncDisposableStack implementation.
2025-01-17 20:46:32 +01:00

26 lines
616 B
C++

/*
* Copyright (c) 2022, David Tuin <davidot@serenityos.org>
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Runtime/DisposableStack.h>
namespace JS {
GC_DEFINE_ALLOCATOR(DisposableStack);
DisposableStack::DisposableStack(DisposeCapability dispose_capability, Object& prototype)
: Object(ConstructWithPrototypeTag::Tag, prototype)
, m_dispose_capability(move(dispose_capability))
{
}
void DisposableStack::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
m_dispose_capability.visit_edges(visitor);
}
}