Closed littledan closed 6 years ago
cc @anba @schuay @bterlson @hashseed @mathiasbynens @tschneidereit @ljharb @getify @msaboff
This patch still test262 needs tests and, ideally, implementations before Stage 4. Is anyone interested in picking that up? Otherwise, I could work on it in the coming weeks.
LGTM.
V8 tracking bug: https://bugs.chromium.org/p/v8/issues/detail?id=7192
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