ArrayIterator.cpp 818 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibJS/Runtime/ArrayIterator.h>
  7. #include <LibJS/Runtime/GlobalObject.h>
  8. namespace JS {
  9. ArrayIterator* ArrayIterator::create(GlobalObject& global_object, Value array, Object::PropertyKind iteration_kind)
  10. {
  11. return global_object.heap().allocate<ArrayIterator>(global_object, array, iteration_kind, *global_object.array_iterator_prototype());
  12. }
  13. ArrayIterator::ArrayIterator(Value array, Object::PropertyKind iteration_kind, Object& prototype)
  14. : Object(prototype)
  15. , m_array(array)
  16. , m_iteration_kind(iteration_kind)
  17. {
  18. }
  19. ArrayIterator::~ArrayIterator()
  20. {
  21. }
  22. void ArrayIterator::visit_edges(Cell::Visitor& visitor)
  23. {
  24. Base::visit_edges(visitor);
  25. visitor.visit(m_array);
  26. }
  27. }