mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
LibJS: Make Array constructor take its prototype
Let's start moving towards native JS objects taking their prototype as a constructor argument. This will eventually allow us to move prototypes off of Interpreter and into GlobalObject.
This commit is contained in:
parent
ee5816b9c8
commit
2d7b495244
7 changed files with 23 additions and 12 deletions
|
@ -67,7 +67,7 @@ Value ObjectConstructor::get_own_property_names(Interpreter& interpreter)
|
|||
auto* object = interpreter.argument(0).to_object(interpreter.heap());
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
auto* result = interpreter.heap().allocate<Array>();
|
||||
auto* result = Array::create(interpreter.global_object());
|
||||
for (size_t i = 0; i < object->elements().size(); ++i) {
|
||||
if (!object->elements()[i].is_empty())
|
||||
result->elements().append(js_string(interpreter, String::number(i)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue