This commit is contained in:
Gus Caplan 2020-09-24 14:20:06 -05:00 committed by Rick Waldron
parent 881c9e3ba5
commit 1d31345a70
2 changed files with 36 additions and 1 deletions

View File

@ -3,7 +3,7 @@
/*---
description: The groups object of indices is created with CreateDataProperty
includes: [compareArray.js]
includes: [propertyHelper.js, compareArray.js]
esid: sec-makeindicesarray
features: [regexp-named-groups, regexp-match-indices]
info: |
@ -15,6 +15,23 @@ info: |
10. Perform ! CreateDataProperty(_A_, `"groups"`, _groups_).
---*/
// `groups` is created with Define, not Set.
let counter = 0;
Object.defineProperty(Array.prototype, "groups", {
set() { counter++; }
});
let indices = /(?<x>.)/.exec("a").indices;
assert.sameValue(counter, 0);
// `groups` is writable, enumerable and configurable
// (from CreateDataProperty).
verifyProperty(indices, 'groups', {
writable: true,
enumerable: true,
configurable: true
});
// The `__proto__` property on the groups object is not special,
// and does not affect the [[Prototype]] of the resulting groups object.
let {groups} = /(?<__proto__>.)/.exec("a").indices;

View File

@ -3,6 +3,7 @@
/*---
description: Properties of the groups object are created with CreateDataProperty
includes: [propertyHelper.js]
esid: sec-regexpbuiltinexec
features: [regexp-named-groups]
info: |
@ -14,6 +15,23 @@ info: |
26. Perform ! CreateDataProperty(_A_, `"groups"`, _groups_).
---*/
// `groups` is created with Define, not Set.
let counter = 0;
Object.defineProperty(Array.prototype, "groups", {
set() { counter++; }
});
let match = /(?<x>.)/.exec("a");
assert.sameValue(counter, 0);
// `groups` is writable, enumerable and configurable
// (from CreateDataProperty).
verifyProperty(match, "groups", {
writable: true,
enumerable: true,
configurable: true,
});
// The `__proto__` property on the groups object is not special,
// and does not affect the [[Prototype]] of the resulting groups object.
let {groups} = /(?<__proto__>.)/.exec("a");