1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:38:12 +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

@ -139,9 +139,7 @@ ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& o
// 8. Else if type is Number, then
else if (type == OptionType::Number) {
// a. 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));
// b. If value is NaN, throw a RangeError exception.
if (value.is_nan())