mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +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:
parent
5ee1ae37b2
commit
e480d69130
17 changed files with 172 additions and 96 deletions
|
@ -1992,7 +1992,7 @@ Value ArrayExpression::execute(Interpreter& interpreter, GlobalObject& global_ob
|
|||
{
|
||||
InterpreterNodeScope node_scope { interpreter, *this };
|
||||
|
||||
auto* array = Array::create(global_object);
|
||||
auto* array = Array::create(global_object, 0);
|
||||
for (auto& element : m_elements) {
|
||||
auto value = Value();
|
||||
if (element) {
|
||||
|
@ -2066,7 +2066,7 @@ Value TaggedTemplateLiteral::execute(Interpreter& interpreter, GlobalObject& glo
|
|||
}
|
||||
auto& tag_function = tag.as_function();
|
||||
auto& expressions = m_template_literal->expressions();
|
||||
auto* strings = Array::create(global_object);
|
||||
auto* strings = Array::create(global_object, 0);
|
||||
MarkedValueList arguments(vm.heap());
|
||||
arguments.append(strings);
|
||||
for (size_t i = 0; i < expressions.size(); ++i) {
|
||||
|
@ -2082,7 +2082,7 @@ Value TaggedTemplateLiteral::execute(Interpreter& interpreter, GlobalObject& glo
|
|||
}
|
||||
}
|
||||
|
||||
auto* raw_strings = Array::create(global_object);
|
||||
auto* raw_strings = Array::create(global_object, 0);
|
||||
for (auto& raw_string : m_template_literal->raw_strings()) {
|
||||
auto value = raw_string.execute(interpreter, global_object);
|
||||
if (vm.exception())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue