1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +00:00

LibJS: Bring ArrayCreate and ArrayConstructor closer to spec

Specifically, this now explicitly takes the length, adds missing
exceptions checks to calls with user-supplied lengths, takes and uses
the prototype argument, and fixes some spec non-conformance in
ArrayConstructor and its native functions around the use of ArrayCreate
This commit is contained in:
Idan Horowitz 2021-07-04 01:36:44 +03:00 committed by Linus Groh
parent 5ee1ae37b2
commit e480d69130
17 changed files with 172 additions and 96 deletions

View file

@ -166,7 +166,7 @@ Value OrdinaryFunctionObject::execute_function_body()
[&](const auto& param) {
Value argument_value;
if (parameter.is_rest) {
auto* array = Array::create(global_object());
auto* array = Array::create(global_object(), 0);
for (size_t rest_index = i; rest_index < execution_context_arguments.size(); ++rest_index)
array->indexed_properties().append(execution_context_arguments[rest_index]);
argument_value = move(array);