Bug 1704385: Add pref for Array.findLast r=mgaudet

Differential Revision: https://phabricator.services.mozilla.com/D148330
This commit is contained in:
Iain Ireland
2022-06-16 22:01:06 +00:00
parent 0e29345ba5
commit b774266d17
12 changed files with 66 additions and 14 deletions

View File

@@ -629,6 +629,7 @@ bool shell::enableIteratorHelpers = false;
#ifdef NIGHTLY_BUILD
bool shell::enableArrayGrouping = true;
#endif
bool shell::enableArrayFindLast = false;
#ifdef ENABLE_CHANGE_ARRAY_BY_COPY
bool shell::enableChangeArrayByCopy = false;
#endif
@@ -4248,6 +4249,7 @@ static void SetStandardRealmOptions(JS::RealmOptions& options) {
#ifdef NIGHTLY_BUILD
.setArrayGroupingEnabled(enableArrayGrouping)
#endif
.setArrayFindLastEnabled(enableArrayFindLast)
#ifdef ENABLE_NEW_SET_METHODS
.setNewSetMethodsEnabled(enableNewSetMethods)
#endif
@@ -11040,6 +11042,7 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) {
#ifdef NIGHTLY_BUILD
enableArrayGrouping = op.getBoolOption("enable-array-grouping");
#endif
enableArrayFindLast = op.getBoolOption("enable-array-find-last");
#ifdef ENABLE_CHANGE_ARRAY_BY_COPY
enableChangeArrayByCopy = op.getBoolOption("enable-change-array-by-copy");
#endif
@@ -12073,6 +12076,8 @@ int main(int argc, char** argv) {
"Enable iterator helpers") ||
!op.addBoolOption('\0', "enable-array-grouping",
"Enable Array Grouping") ||
!op.addBoolOption('\0', "enable-array-find-last",
"Enable Array.findLast/findLastIndex") ||
#ifdef ENABLE_CHANGE_ARRAY_BY_COPY
!op.addBoolOption('\0', "enable-change-array-by-copy",
"Enable change-array-by-copy methods") ||