diff options
author | Linus Groh <mail@linusgroh.de> | 2022-12-06 22:03:52 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-12-07 16:43:06 +0000 |
commit | 5db38d7ba1a8caa5138dd65cc06be0c0e5a568e4 (patch) | |
tree | 6968f34445aceedd484c1b71eef06e7914d5e6c6 /Tests | |
parent | 07f1aad3dd81dfbd047f34b32bc82a49e07f79e5 (diff) | |
download | serenity-5db38d7ba1a8caa5138dd65cc06be0c0e5a568e4.zip |
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<BigInt> while
we're here.
This is patch 1/3, replacement of js_string() and js_symbol() follow.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/LibWasm/test-wasm.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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<double>(value)); }, [&](i32 value) { return JS::Value(static_cast<double>(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<double>(value)); }, [&](i32 value) { return_value = JS::Value(static_cast<double>(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(); }, |