diff options
author | Linus Groh <mail@linusgroh.de> | 2021-06-06 23:25:33 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-06-06 23:25:33 +0100 |
commit | 1c906b07a4d3a3b70f255fda2348d507ec123df8 (patch) | |
tree | 09349a87bf656b384caf37d7f12017181db6e5ff /Userland/Libraries/LibJS/Runtime/Array.h | |
parent | e7bfd34ea722a3aef2d3d099b1e3b36d261059d4 (diff) | |
download | serenity-1c906b07a4d3a3b70f255fda2348d507ec123df8.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Array.h')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Array.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Array.h b/Userland/Libraries/LibJS/Runtime/Array.h index 58b4b19c8b..ea204a02bb 100644 --- a/Userland/Libraries/LibJS/Runtime/Array.h +++ b/Userland/Libraries/LibJS/Runtime/Array.h @@ -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); |