ArrayIterator.cpp 781 B

123456789101112131415161718192021222324252627282930
  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. void ArrayIterator::visit_edges(Cell::Visitor& visitor)
  20. {
  21. Base::visit_edges(visitor);
  22. visitor.visit(m_array);
  23. }
  24. }