mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibJS: Convert to_number() to ThrowCompletionOr
This commit is contained in:
parent
a36ee213b9
commit
20d990563c
Notes:
sideshowbarker
2024-07-18 02:12:47 +09:00
Author: https://github.com/IdanHo
Commit: 20d990563c
Pull-request: https://github.com/SerenityOS/serenity/pull/10522
Reviewed-by: https://github.com/linusg ✅
22 changed files with 149 additions and 343 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue