1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:07:34 +00:00

LibJS: Add length parameter to Array::create()

This is now a bit closer to the spec's 10.4.2.2 ArrayCreate - it will
throw a RangeError if the requested length exceeds 2^32 - 1, so anyone
passing in a custom value (defaults to zero for same behaviour as
before) will need an exception check at the call site.
This commit is contained in:
Linus Groh 2021-06-06 23:25:33 +01:00
parent e7bfd34ea7
commit 1c906b07a4
2 changed files with 12 additions and 3 deletions

View file

@ -14,7 +14,7 @@ class Array : public Object {
JS_OBJECT(Array, Object);
public:
static Array* create(GlobalObject&);
static Array* create(GlobalObject&, size_t length = 0);
static Array* create_from(GlobalObject&, const Vector<Value>&);
explicit Array(Object& prototype);