Map.h 757 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/HashMap.h>
  8. #include <LibJS/Runtime/GlobalObject.h>
  9. #include <LibJS/Runtime/Object.h>
  10. #include <LibJS/Runtime/Value.h>
  11. namespace JS {
  12. class Map : public Object {
  13. JS_OBJECT(Map, Object);
  14. public:
  15. static Map* create(GlobalObject&);
  16. explicit Map(Object& prototype);
  17. virtual ~Map() override;
  18. OrderedHashMap<Value, Value, ValueTraits> const& entries() const { return m_entries; };
  19. OrderedHashMap<Value, Value, ValueTraits>& entries() { return m_entries; };
  20. private:
  21. virtual void visit_edges(Visitor& visitor) override;
  22. OrderedHashMap<Value, Value, ValueTraits> m_entries;
  23. };
  24. }