BigIntObject.cpp 702 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (c) 2020-2023, Linus Groh <linusg@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibJS/Runtime/BigIntObject.h>
  7. #include <LibJS/Runtime/GlobalObject.h>
  8. namespace JS {
  9. JS_DEFINE_ALLOCATOR(BigIntObject);
  10. NonnullGCPtr<BigIntObject> BigIntObject::create(Realm& realm, BigInt& bigint)
  11. {
  12. return realm.heap().allocate<BigIntObject>(realm, bigint, realm.intrinsics().bigint_prototype());
  13. }
  14. BigIntObject::BigIntObject(BigInt& bigint, Object& prototype)
  15. : Object(ConstructWithPrototypeTag::Tag, prototype)
  16. , m_bigint(bigint)
  17. {
  18. }
  19. void BigIntObject::visit_edges(Cell::Visitor& visitor)
  20. {
  21. Base::visit_edges(visitor);
  22. visitor.visit(m_bigint);
  23. }
  24. }