summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Map.cpp
blob: a3bc8ac05a9886d30a06e6a796a664bbf19398c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibJS/Runtime/Map.h>

namespace JS {

Map* Map::create(GlobalObject& global_object)
{
    return global_object.heap().allocate<Map>(global_object, *global_object.map_prototype());
}

Map::Map(Object& prototype)
    : Object(prototype)
{
}

Map::~Map()
{
}

void Map::visit_edges(Cell::Visitor& visitor)
{
    Object::visit_edges(visitor);
    for (auto& value : m_entries) {
        visitor.visit(value.key);
        visitor.visit(value.value);
    }
}

}