Open Bug 1773135 Opened 2 years ago Updated 1 year ago

[META] Duplicate named capture groups

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: yulia, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug, )

Details

(Keywords: dev-doc-needed, meta, Whiteboard: [DocArea=JS])

This will likely be part of a future regex integration

Regexps with named captures always call into CreateRegExpMatchResult, so the changes to make this happen are:

  1. Right now, RegExpShared represents named captures using a) a pre-allocated shape with the right property names, and b) an array with one element per named capture, indicating the index of the capture group with that name. For duplicate captures, we'll instead need an arbitrarily long list of indices per named capture. This happens in initializeNamedCaptures.
  2. According to the discussion here, the order in which the properties are created is intended to be deterministic (rather than varying per invocation of the regexp), so we can continue using a pre-computed shape.
  3. In CreateRegExpMatchResult, we will have to use the new representation instead of the old one. Presumably this means iterating over the list of indices for a named capture until we find one that matched.
Summary: Implement Duplicate named capture groups → [META] Duplicate named capture groups
Depends on: 1826573
You need to log in before you can comment on or make changes to this bug.