Set.cpp 558 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(Realm& realm)
  9. {
  10. return realm.heap().allocate<Set>(realm, *realm.intrinsics().set_prototype());
  11. }
  12. Set::Set(Object& prototype)
  13. : Object(prototype)
  14. , m_values(*prototype.shape().realm().intrinsics().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. }