2020-07-09 21:58:20 +00:00
|
|
|
/*
|
2021-04-22 23:53:07 +00:00
|
|
|
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
|
2020-07-09 21:58:20 +00:00
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-07-09 21:58:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <LibJS/Runtime/ArrayIterator.h>
|
|
|
|
#include <LibJS/Runtime/GlobalObject.h>
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
2022-08-15 23:20:49 +00:00
|
|
|
ArrayIterator* ArrayIterator::create(Realm& realm, Value array, Object::PropertyKind iteration_kind)
|
2020-07-09 21:58:20 +00:00
|
|
|
{
|
2022-08-26 23:54:55 +00:00
|
|
|
return realm.heap().allocate<ArrayIterator>(realm, array, iteration_kind, *realm.intrinsics().array_iterator_prototype());
|
2020-07-09 21:58:20 +00:00
|
|
|
}
|
|
|
|
|
2021-06-19 22:21:08 +00:00
|
|
|
ArrayIterator::ArrayIterator(Value array, Object::PropertyKind iteration_kind, Object& prototype)
|
2020-07-09 21:58:20 +00:00
|
|
|
: Object(prototype)
|
|
|
|
, m_array(array)
|
|
|
|
, m_iteration_kind(iteration_kind)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-11-28 13:33:36 +00:00
|
|
|
void ArrayIterator::visit_edges(Cell::Visitor& visitor)
|
2020-09-08 14:20:13 +00:00
|
|
|
{
|
2020-11-28 13:33:36 +00:00
|
|
|
Base::visit_edges(visitor);
|
2020-09-08 14:20:13 +00:00
|
|
|
visitor.visit(m_array);
|
|
|
|
}
|
|
|
|
|
2020-07-09 21:58:20 +00:00
|
|
|
}
|