From 5db38d7ba1a8caa5138dd65cc06be0c0e5a568e4 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 6 Dec 2022 22:03:52 +0000 Subject: LibJS: Replace standalone js_bigint() with BigInt::create() Three standalone Cell creation functions remain in the JS namespace: - js_bigint() - js_string() - js_symbol() All of them are leftovers from early iterations when LibJS still took inspiration from JSC, which itself has jsString(). Nowadays, we pretty much exclusively use static create() functions to construct types allocated on the JS heap, and there's no reason to not do the same for these. Also change the return type from BigInt* to NonnullGCPtr while we're here. This is patch 1/3, replacement of js_string() and js_symbol() follow. --- Userland/Libraries/LibJS/Runtime/BigInt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Userland/Libraries/LibJS/Runtime/BigInt.h') diff --git a/Userland/Libraries/LibJS/Runtime/BigInt.h b/Userland/Libraries/LibJS/Runtime/BigInt.h index 8c58a58df6..8a853933fa 100644 --- a/Userland/Libraries/LibJS/Runtime/BigInt.h +++ b/Userland/Libraries/LibJS/Runtime/BigInt.h @@ -16,6 +16,8 @@ class BigInt final : public Cell { JS_CELL(BigInt, Cell); public: + [[nodiscard]] static NonnullGCPtr create(VM&, Crypto::SignedBigInteger); + virtual ~BigInt() override = default; Crypto::SignedBigInteger const& big_integer() const { return m_big_integer; } @@ -27,8 +29,6 @@ private: Crypto::SignedBigInteger m_big_integer; }; -BigInt* js_bigint(Heap&, Crypto::SignedBigInteger); -BigInt* js_bigint(VM&, Crypto::SignedBigInteger); ThrowCompletionOr number_to_bigint(VM&, Value); } -- cgit v1.2.3