1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +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

@ -431,7 +431,7 @@ Value ProxyObject::call()
arguments.append(Value(&m_target));
arguments.append(Value(&m_handler));
// FIXME: Pass global object
auto arguments_array = Array::create(global_object());
auto arguments_array = Array::create(global_object(), 0);
vm.for_each_argument([&](auto& argument) {
arguments_array->indexed_properties().append(argument);
});
@ -458,7 +458,7 @@ Value ProxyObject::construct(FunctionObject& new_target)
return static_cast<FunctionObject&>(m_target).construct(new_target);
MarkedValueList arguments(vm.heap());
arguments.append(Value(&m_target));
auto arguments_array = Array::create(global_object());
auto arguments_array = Array::create(global_object(), 0);
vm.for_each_argument([&](auto& argument) {
arguments_array->indexed_properties().append(argument);
});