Coverage Report

Created: 2026-09-26 06:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibJS/Runtime/MapIterator.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#pragma once
8
9
#include <AK/HashMap.h>
10
#include <LibJS/Runtime/Map.h>
11
#include <LibJS/Runtime/Object.h>
12
13
namespace JS {
14
15
class MapIterator final : public Object {
16
    JS_OBJECT(MapIterator, Object);
17
    JS_DECLARE_ALLOCATOR(MapIterator);
18
19
public:
20
    static NonnullGCPtr<MapIterator> create(Realm&, Map& map, Object::PropertyKind iteration_kind);
21
22
    virtual ~MapIterator() override = default;
23
24
0
    Map& map() const { return m_map; }
25
0
    bool done() const { return m_done; }
26
0
    Object::PropertyKind iteration_kind() const { return m_iteration_kind; }
27
28
private:
29
    friend class MapIteratorPrototype;
30
31
    explicit MapIterator(Map& map, Object::PropertyKind iteration_kind, Object& prototype);
32
33
    virtual void visit_edges(Cell::Visitor&) override;
34
35
    NonnullGCPtr<Map> m_map;
36
    bool m_done { false };
37
    Object::PropertyKind m_iteration_kind;
38
    Map::ConstIterator m_iterator;
39
};
40
41
}