LibJS: Use INVALID some more in abstract operations

This commit is contained in:
Linus Groh 2021-01-09 16:32:23 +01:00 committed by Andreas Kling
parent 8ff0afd829
commit c55cb7843a
Notes: sideshowbarker 2024-07-19 00:00:03 +09:00

View file

@ -480,7 +480,7 @@ double Value::to_double(GlobalObject& global_object) const
{
auto number = to_number(global_object);
if (global_object.vm().exception())
return 0;
return INVALID;
return number.as_double();
}
@ -488,7 +488,7 @@ i32 Value::to_i32(GlobalObject& global_object) const
{
auto number = to_number(global_object);
if (global_object.vm().exception())
return 0;
return INVALID;
if (number.is_nan() || number.is_infinity())
return 0;
return number.as_i32();