mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:27:35 +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
|
@ -559,11 +559,11 @@ ThrowCompletionOr<u64> Value::to_bigint_uint64(GlobalObject& global_object) cons
|
|||
return bigint->big_integer().to_u64();
|
||||
}
|
||||
|
||||
double Value::to_double(GlobalObject& global_object) const
|
||||
ThrowCompletionOr<double> Value::to_double(GlobalObject& global_object) const
|
||||
{
|
||||
auto number = to_number(global_object);
|
||||
if (global_object.vm().exception())
|
||||
return {};
|
||||
if (auto* exception = global_object.vm().exception())
|
||||
return throw_completion(exception->value());
|
||||
return number.as_double();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue