archives

« Bugzilla Issues Index

#3469 — 21.2.5.11 RegExp.prototype [ @@split ]: Wrong loop indexing and missing increment for lengthA


21.2.5.11 RegExp.prototype [ @@split ] ( string, limit )

(1) Increment `lengthA` after step 23.f.iv.3
(2) The capturing group indexing is wrong in 23.f.iv.9.

Maybe change to:
---
Let captureLen be ToLength(Get(splitter, "length")).
ReturnIfAbrupt(captureLen).
Let i be 1.
Repeat while i < captureLen.
Let nextCapture be Get(splitter, ToString(i)).
Let i be i + 1.
...
---

Or:
---
Let nCaptures be ToLength(Get(result, "length")).
ReturnIfAbrupt(nCaptures).
Let nCaptures be max(nCaptures − 1, 0).
Let i be 1.
Repeat while i ≤ nCaptures.
Let nextCapture be Get(splitter, ToString(i)).
Let i be i + 1.
...
---

Also see step 17 in 21.2.5.8 RegExp.prototype [ @@replace ].


fixed in rev30 editor's draft


fixed in rev30