This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normative: Create a groups property unconditionally
If the RegExp does not have named groups, set a groups property of the result to undefined. This change is made to facilitate optimizing RegExp implementations, which often take a "fast path" for built-in, unmodified to not incur the overhead of the full subclassable semantics. If the "groups" property may be read from higher up on the prototype chain, the fast path for RegExp.prototype.replace would become more complex or slower, or alternatively, more conditions about the environment might need to be checked as a precondition to apply the fast path. An alternate approach would be to only read an own groups property based on a HasOwnProperty test followed by a Get. I don't see big advantages or disadvantages to that approach vs this one, and I'd be fine to revisit this patch if more differentiating factors are raised before Stage 4. Closes #34
- Loading branch information