1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

LibJS: Replace all uses of to_size_t() and remove it :^)

Yay for more spec compliance! This is pretty easy as everything using
to_size_t() should just be using one of the other abstract operations we
already have implemented.
This allows us to get rid of get_length() in ArrayPrototype, which is
basically a slightly incorrect implementation of length_of_array_like(),
and then finally remove to_size_t()!
Also fixes a couple of "argument is undefined" vs "argument isn't given"
issues along the way.
This commit is contained in:
Linus Groh 2021-01-10 21:13:58 +01:00 committed by Andreas Kling
parent 9be0b664e3
commit f369229770
6 changed files with 47 additions and 83 deletions

View file

@ -63,10 +63,7 @@ static void prepare_arguments_list(GlobalObject& global_object, Value value, Mar
return;
}
auto& arguments_list = value.as_object();
auto length_property = arguments_list.get(vm.names.length);
if (vm.exception())
return;
auto length = length_property.to_size_t(global_object);
auto length = length_of_array_like(global_object, arguments_list);
if (vm.exception())
return;
for (size_t i = 0; i < length; ++i) {