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. --- Tests/LibWasm/test-wasm.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Tests') diff --git a/Tests/LibWasm/test-wasm.cpp b/Tests/LibWasm/test-wasm.cpp index 22b510c1e1..c339c70726 100644 --- a/Tests/LibWasm/test-wasm.cpp +++ b/Tests/LibWasm/test-wasm.cpp @@ -174,7 +174,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::get_export) return m_machine.store().get(*v)->value().value().visit( [&](auto const& value) -> JS::Value { return JS::Value(static_cast(value)); }, [&](i32 value) { return JS::Value(static_cast(value)); }, - [&](i64 value) -> JS::Value { return JS::js_bigint(vm, Crypto::SignedBigInteger { value }); }, + [&](i64 value) -> JS::Value { return JS::BigInt::create(vm, Crypto::SignedBigInteger { value }); }, [&](Wasm::Reference const& reference) -> JS::Value { return reference.ref().visit( [&](const Wasm::Reference::Null&) -> JS::Value { return JS::js_null(); }, @@ -253,7 +253,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::wasm_invoke) result.values().first().value().visit( [&](auto const& value) { return_value = JS::Value(static_cast(value)); }, [&](i32 value) { return_value = JS::Value(static_cast(value)); }, - [&](i64 value) { return_value = JS::Value(JS::js_bigint(vm, Crypto::SignedBigInteger { value })); }, + [&](i64 value) { return_value = JS::Value(JS::BigInt::create(vm, Crypto::SignedBigInteger { value })); }, [&](Wasm::Reference const& reference) { reference.ref().visit( [&](const Wasm::Reference::Null&) { return_value = JS::js_null(); }, -- cgit v1.2.3