
This is a continuation of the previous three commits. Now that create() receives the allocating realm, we can simply forward that to allocate(), which accounts for the majority of these changes. Additionally, we can get rid of the realm_from_global_object() in one place, with one more remaining in VM::throw_completion().
31 lines
790 B
C++
31 lines
790 B
C++
/*
|
|
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibJS/Runtime/GlobalObject.h>
|
|
#include <LibJS/Runtime/SetIterator.h>
|
|
|
|
namespace JS {
|
|
|
|
SetIterator* SetIterator::create(Realm& realm, Set& set, Object::PropertyKind iteration_kind)
|
|
{
|
|
return realm.heap().allocate<SetIterator>(realm, set, iteration_kind, *realm.global_object().set_iterator_prototype());
|
|
}
|
|
|
|
SetIterator::SetIterator(Set& set, Object::PropertyKind iteration_kind, Object& prototype)
|
|
: Object(prototype)
|
|
, m_set(set)
|
|
, m_iteration_kind(iteration_kind)
|
|
, m_iterator(static_cast<Set const&>(set).begin())
|
|
{
|
|
}
|
|
|
|
void SetIterator::visit_edges(Cell::Visitor& visitor)
|
|
{
|
|
Base::visit_edges(visitor);
|
|
visitor.visit(&m_set);
|
|
}
|
|
|
|
}
|