mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:34:57 +00:00
LibJS: Add DisposableStack{, Prototype, Constructor}
Since the async parts of the spec are not stage 3 at this point we don't add AsyncDisposableStack.
This commit is contained in:
parent
bff038411a
commit
6255ca4a42
22 changed files with 868 additions and 0 deletions
26
Userland/Libraries/LibJS/Runtime/DisposableStack.cpp
Normal file
26
Userland/Libraries/LibJS/Runtime/DisposableStack.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2022, David Tuin <davidot@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Runtime/DisposableStack.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
DisposableStack::DisposableStack(Vector<DisposableResource> stack, Object& prototype)
|
||||
: Object(ConstructWithPrototypeTag::Tag, prototype)
|
||||
, m_disposable_resource_stack(move(stack))
|
||||
{
|
||||
}
|
||||
|
||||
void DisposableStack::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
for (auto& resource : m_disposable_resource_stack) {
|
||||
visitor.visit(resource.resource_value);
|
||||
visitor.visit(resource.dispose_method);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue