1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 01:25:09 +00:00

LibJS: Convert to_bigint() to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-10-16 21:52:16 +03:00 committed by Linus Groh
parent b8f101888b
commit e87cea8248
10 changed files with 27 additions and 56 deletions

View file

@ -388,9 +388,7 @@ Optional<Wasm::Value> to_webassembly_value(JS::Value value, const Wasm::ValueTyp
switch (type.kind()) {
case Wasm::ValueType::I64: {
auto bigint = value.to_bigint(global_object);
if (vm.exception())
return {};
auto bigint = TRY_OR_DISCARD(value.to_bigint(global_object));
auto value = bigint->big_integer().divided_by(two_64).remainder;
VERIFY(value.unsigned_value().trimmed_length() <= 2);
i64 integer = static_cast<i64>(value.unsigned_value().to_u64());