1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:27:35 +00:00

LibJS: Convert to_number() to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-10-17 23:20:05 +03:00
parent a36ee213b9
commit 20d990563c
22 changed files with 149 additions and 343 deletions

View file

@ -98,9 +98,7 @@ ThrowCompletionOr<TemporalDuration> to_temporal_duration_record(GlobalObject& gl
any = true;
// ii. Let val be ? ToNumber(val).
value = value.to_number(global_object);
if (auto* exception = vm.exception())
return throw_completion(exception->value());
value = TRY(value.to_number(global_object));
// iii. If ! IsIntegralNumber(val) is false, then
if (!value.is_integral_number()) {
@ -196,9 +194,7 @@ ThrowCompletionOr<PartialDuration> to_partial_duration(GlobalObject& global_obje
any = true;
// ii. Set value to ? ToNumber(value).
value = value.to_number(global_object);
if (auto* exception = vm.exception())
return throw_completion(exception->value());
value = TRY(value.to_number(global_object));
// iii. If ! IsIntegralNumber(value) is false, then
if (!value.is_integral_number()) {