mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-31 03:51:38 +09:00
Implement array.flat and array.flatMap
Self-hosted implementation that adds both functions and adds them to @@unscopables as specced in ES2019. Resolves #1095
This commit is contained in:
parent
b39b43014b
commit
3538814b92
5 changed files with 120 additions and 1 deletions
|
|
@ -3169,6 +3169,11 @@ static const JSFunctionSpec array_methods[] = {
|
|||
|
||||
/* ES7 additions */
|
||||
JS_SELF_HOSTED_FN("includes", "ArrayIncludes", 2,0),
|
||||
|
||||
/* ES2019 additions */
|
||||
JS_SELF_HOSTED_FN("flat", "ArrayFlat", 0,0),
|
||||
JS_SELF_HOSTED_FN("flatMap", "ArrayFlatMap", 1,0),
|
||||
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
|
|
@ -3333,6 +3338,8 @@ array_proto_finish(JSContext* cx, JS::HandleObject ctor, JS::HandleObject proto)
|
|||
!DefineProperty(cx, unscopables, cx->names().fill, value) ||
|
||||
!DefineProperty(cx, unscopables, cx->names().find, value) ||
|
||||
!DefineProperty(cx, unscopables, cx->names().findIndex, value) ||
|
||||
!DefineProperty(cx, unscopables, cx->names().flat, value) ||
|
||||
!DefineProperty(cx, unscopables, cx->names().flatMap, value) ||
|
||||
!DefineProperty(cx, unscopables, cx->names().includes, value) ||
|
||||
!DefineProperty(cx, unscopables, cx->names().keys, value) ||
|
||||
!DefineProperty(cx, unscopables, cx->names().values, value))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue