2020-06-05 21:14:10 -03:00
|
|
|
/*
|
2022-12-13 17:49:50 -03:00
|
|
|
* Copyright (c) 2020-2022, Linus Groh <linusg@serenityos.org>
|
2020-06-05 21:14:10 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-05 21:14:10 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2025-07-19 17:49:30 -03:00
|
|
|
#include <LibJS/Export.h>
|
2020-06-05 21:14:10 -03:00
|
|
|
#include <LibJS/Runtime/BigInt.h>
|
|
|
|
|
#include <LibJS/Runtime/Object.h>
|
|
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
2025-07-19 17:49:30 -03:00
|
|
|
class JS_API BigIntObject final : public Object {
|
2020-06-21 10:14:02 -03:00
|
|
|
JS_OBJECT(BigIntObject, Object);
|
2024-11-14 12:01:23 -03:00
|
|
|
GC_DECLARE_ALLOCATOR(BigIntObject);
|
2020-06-21 10:14:02 -03:00
|
|
|
|
2020-06-05 21:14:10 -03:00
|
|
|
public:
|
2024-11-14 12:01:23 -03:00
|
|
|
static GC::Ref<BigIntObject> create(Realm&, BigInt&);
|
2020-06-05 21:14:10 -03:00
|
|
|
|
2022-03-14 13:25:06 -03:00
|
|
|
virtual ~BigIntObject() override = default;
|
2020-06-05 21:14:10 -03:00
|
|
|
|
2021-10-18 15:44:46 -03:00
|
|
|
BigInt const& bigint() const { return m_bigint; }
|
|
|
|
|
BigInt& bigint() { return m_bigint; }
|
|
|
|
|
|
2020-06-05 21:14:10 -03:00
|
|
|
private:
|
2022-08-28 18:51:28 -03:00
|
|
|
BigIntObject(BigInt&, Object& prototype);
|
|
|
|
|
|
2025-03-25 05:34:06 -03:00
|
|
|
virtual bool is_bigint_object() const final { return true; }
|
|
|
|
|
|
2020-11-28 10:33:36 -03:00
|
|
|
virtual void visit_edges(Visitor&) override;
|
2020-06-05 21:14:10 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ref<BigInt> m_bigint;
|
2020-06-05 21:14:10 -03:00
|
|
|
};
|
|
|
|
|
|
2025-03-25 05:34:06 -03:00
|
|
|
template<>
|
|
|
|
|
inline bool Object::fast_is<BigIntObject>() const { return is_bigint_object(); }
|
|
|
|
|
|
2020-06-05 21:14:10 -03:00
|
|
|
}
|