/src/serenity/Userland/Libraries/LibJS/Runtime/MapIterator.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibJS/Runtime/GlobalObject.h> |
8 | | #include <LibJS/Runtime/MapIterator.h> |
9 | | |
10 | | namespace JS { |
11 | | |
12 | | JS_DEFINE_ALLOCATOR(MapIterator); |
13 | | |
14 | | NonnullGCPtr<MapIterator> MapIterator::create(Realm& realm, Map& map, Object::PropertyKind iteration_kind) |
15 | 0 | { |
16 | 0 | return realm.heap().allocate<MapIterator>(realm, map, iteration_kind, realm.intrinsics().map_iterator_prototype()); |
17 | 0 | } |
18 | | |
19 | | MapIterator::MapIterator(Map& map, Object::PropertyKind iteration_kind, Object& prototype) |
20 | 0 | : Object(ConstructWithPrototypeTag::Tag, prototype) |
21 | 0 | , m_map(map) |
22 | 0 | , m_iteration_kind(iteration_kind) |
23 | 0 | , m_iterator(static_cast<Map const&>(map).begin()) |
24 | 0 | { |
25 | 0 | } |
26 | | |
27 | | void MapIterator::visit_edges(Cell::Visitor& visitor) |
28 | 0 | { |
29 | 0 | Base::visit_edges(visitor); |
30 | 0 | visitor.visit(m_map); |
31 | 0 | } |
32 | | |
33 | | } |