Set.cpp 533 B

1234567891011121314151617181920212223242526272829303132
  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. {
  15. }
  16. void Set::initialize(Realm& realm)
  17. {
  18. m_values = Map::create(realm);
  19. }
  20. void Set::visit_edges(Cell::Visitor& visitor)
  21. {
  22. Base::visit_edges(visitor);
  23. visitor.visit(m_values);
  24. }
  25. }