Set.cpp 571 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibJS/Runtime/Set.h>
  7. namespace JS {
  8. Set* Set::create(GlobalObject& global_object)
  9. {
  10. return global_object.heap().allocate<Set>(global_object, *global_object.set_prototype());
  11. }
  12. Set::Set(Object& prototype)
  13. : Object(prototype)
  14. , m_values(*prototype.global_object().map_prototype())
  15. {
  16. }
  17. void Set::visit_edges(Cell::Visitor& visitor)
  18. {
  19. Base::visit_edges(visitor);
  20. static_cast<Object&>(m_values).visit_edges(visitor);
  21. }
  22. }