summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/Array.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibJS/Runtime/Array.cpp')
-rw-r--r--Libraries/LibJS/Runtime/Array.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/Libraries/LibJS/Runtime/Array.cpp b/Libraries/LibJS/Runtime/Array.cpp
index 78341ca338..2d526e1081 100644
--- a/Libraries/LibJS/Runtime/Array.cpp
+++ b/Libraries/LibJS/Runtime/Array.cpp
@@ -27,13 +27,21 @@
#include <AK/Function.h>
#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/Array.h>
+#include <LibJS/Runtime/GlobalObject.h>
+#include <LibJS/Runtime/ArrayPrototype.h>
#include <LibJS/Runtime/Error.h>
namespace JS {
-Array::Array()
+Array* Array::create(GlobalObject& global_object)
{
- set_prototype(interpreter().array_prototype());
+ auto& interpreter = global_object.interpreter();
+ return interpreter.heap().allocate<Array>(*interpreter.array_prototype());
+}
+
+Array::Array(Object& prototype)
+{
+ set_prototype(&prototype);
put_native_property("length", length_getter, length_setter);
}