mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 21:58:10 +00:00
LibJS: Convert to_double() to ThrowCompletionOr
This commit is contained in:
parent
51c33b3b35
commit
1639ed7e0a
10 changed files with 23 additions and 40 deletions
|
@ -403,15 +403,11 @@ Optional<Wasm::Value> to_webassembly_value(JS::Value value, const Wasm::ValueTyp
|
|||
return Wasm::Value { static_cast<i32>(_i32) };
|
||||
}
|
||||
case Wasm::ValueType::F64: {
|
||||
auto number = value.to_double(global_object);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
auto number = TRY_OR_DISCARD(value.to_double(global_object));
|
||||
return Wasm::Value { static_cast<double>(number) };
|
||||
}
|
||||
case Wasm::ValueType::F32: {
|
||||
auto number = value.to_double(global_object);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
auto number = TRY_OR_DISCARD(value.to_double(global_object));
|
||||
return Wasm::Value { static_cast<float>(number) };
|
||||
}
|
||||
case Wasm::ValueType::FunctionReference:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue