mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +00:00
LibJS: Return default-constructed values instead of the INVALID constant
This is much more common across the whole codebase and even these two files. The same is used to return an empty JS::Value in an exception check, for example.
This commit is contained in:
parent
657d17ace3
commit
1a7828a9f3
2 changed files with 16 additions and 22 deletions
|
@ -31,9 +31,6 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
// Used in various abstract operations to make it obvious when a non-optional return value must be discarded.
|
||||
static constexpr double INVALID { 0 };
|
||||
|
||||
// 7.2.1 RequireObjectCoercible ( argument ), https://tc39.es/ecma262/#sec-requireobjectcoercible
|
||||
Value require_object_coercible(GlobalObject& global_object, Value value)
|
||||
{
|
||||
|
@ -51,7 +48,7 @@ size_t length_of_array_like(GlobalObject& global_object, Object const& object)
|
|||
auto& vm = global_object.vm();
|
||||
auto result = object.get(vm.names.length);
|
||||
if (vm.exception())
|
||||
return INVALID;
|
||||
return {};
|
||||
return result.to_length(global_object);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue