summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Map.h
blob: 77f7b486daa0cb86fad375da65e64fa091038f8a (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
 */

#pragma once

#include <AK/HashMap.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/Value.h>

namespace JS {

class Map : public Object {
    JS_OBJECT(Map, Object);

public:
    static Map* create(GlobalObject&);

    explicit Map(Object& prototype);
    virtual ~Map() override;

    OrderedHashMap<Value, Value, ValueTraits> const& entries() const { return m_entries; };
    OrderedHashMap<Value, Value, ValueTraits>& entries() { return m_entries; };

private:
    virtual void visit_edges(Visitor& visitor) override;

    OrderedHashMap<Value, Value, ValueTraits> m_entries;
};

}