/src/serenity/Userland/Libraries/LibJS/Runtime/ArrayIterator.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibJS/Runtime/ArrayIterator.h> |
8 | | #include <LibJS/Runtime/GlobalObject.h> |
9 | | |
10 | | namespace JS { |
11 | | |
12 | | JS_DEFINE_ALLOCATOR(ArrayIterator); |
13 | | |
14 | | NonnullGCPtr<ArrayIterator> ArrayIterator::create(Realm& realm, Value array, Object::PropertyKind iteration_kind) |
15 | 0 | { |
16 | 0 | return realm.heap().allocate<ArrayIterator>(realm, array, iteration_kind, realm.intrinsics().array_iterator_prototype()); |
17 | 0 | } |
18 | | |
19 | | ArrayIterator::ArrayIterator(Value array, Object::PropertyKind iteration_kind, Object& prototype) |
20 | 0 | : Object(ConstructWithPrototypeTag::Tag, prototype) |
21 | 0 | , m_array(array) |
22 | 0 | , m_iteration_kind(iteration_kind) |
23 | 0 | { |
24 | 0 | } |
25 | | |
26 | | void ArrayIterator::visit_edges(Cell::Visitor& visitor) |
27 | 0 | { |
28 | 0 | Base::visit_edges(visitor); |
29 | 0 | visitor.visit(m_array); |
30 | 0 | } |
31 | | |
32 | | } |