mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibCrypto+LibJS: Remove the create_from methods from BigInteger
Instead we just use a specific constructor. With this set of constructors using curly braces for constructing is highly recommended. As then it will not do too many implicit conversions which could lead to unexpected loss of data or calling the much slower double constructor. Also to ensure we don't feed (Un)SignedBigInteger infinities we throw RangeError earlier for Durations.
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 07:42:40 +09:00
Author: https://github.com/davidot Commit: https://github.com/SerenityOS/serenity/commit/791855deab Pull-request: https://github.com/SerenityOS/serenity/pull/15029 Reviewed-by: https://github.com/linusg ✅ Reviewed-by: https://github.com/trflynn89
@@ -370,7 +370,7 @@ JS::Value to_js_value(JS::VM& vm, Wasm::Value& wasm_value)
|
||||
auto& realm = *vm.current_realm();
|
||||
switch (wasm_value.type().kind()) {
|
||||
case Wasm::ValueType::I64:
|
||||
return realm.heap().allocate<JS::BigInt>(realm, ::Crypto::SignedBigInteger::create_from(wasm_value.to<i64>().value()));
|
||||
return realm.heap().allocate<JS::BigInt>(realm, ::Crypto::SignedBigInteger { wasm_value.to<i64>().value() });
|
||||
case Wasm::ValueType::I32:
|
||||
return JS::Value(wasm_value.to<i32>().value());
|
||||
case Wasm::ValueType::F64:
|
||||
|
||||
Reference in New Issue
Block a user