Closed
Bug 1540021
Opened 1 year ago
Closed 3 months ago
Implement the String.prototype.replaceAll proposal
Categories
(Core :: JavaScript: Standard Library, enhancement, P3)
Core
JavaScript: Standard Library
P3
Tracking
()
RESOLVED
FIXED
mozilla72
| Tracking | Status | |
|---|---|---|
| firefox72 | --- | fixed |
People
(Reporter: alex.fdm, Assigned: anba)
References
(Blocks 2 open bugs, )
Details
(Keywords: dev-doc-needed)
Attachments
(1 file)
The proposal is now on Stage 2.
| Reporter | ||
Updated•1 year ago
|
Updated•1 year ago
|
Keywords: dev-doc-needed
Updated•1 year ago
|
Priority: -- → P3
Comment 1•4 months ago
|
||
The proposal advanced to stage 3 at today’s TC39 meeting.
| Reporter | ||
Updated•4 months ago
|
| Assignee | ||
Updated•4 months ago
|
Component: JavaScript Engine → JavaScript: Standard Library
| Assignee | ||
Comment 2•3 months ago
|
||
This change doesn't include the String.prototype.matchAll modifications, because
those are already part of the main spec.
MCallOptimize.cpp:
- The inlining is more conservative than
inlineIsRegExpObject, because it's not
clear at this point we need the extra features frominlineIsRegExpObject.
String.js:
- The self-hosted part is slightly different than the current spec text, because
it combines the match and replace loops. The non-functional replace part is
implemented in C++, so we can reuse the existing C++ matcher functions.
String.cpp:
- Added some extra assertions to
AppendDollarReplacementand also had to change
theinfallibleAppendcall into a normalappendcall, because when called
fromreplaceAll, we may not have reserved enough space in the StringBuffer. replaceAllhas a specialised implementation when the pattern is the empty
string, because in that case the pattern is interleaved in-between each
character, so we don't need to find the next match and can also directly reserve
the correct string length (when no '$' characters are present in the replacement
string). This should allow users to update from the previous
str.split("").join(r)pattern tostr.replaceAll("", r)without loss of
performance.- When the pattern isn't the empty string, we reuse the existing
StringMatch
andAppendDollarReplacementfunctions to match and replace the pattern.
This feature is still restricted to Nightly, because no test262 tests are
currently available.
| Assignee | ||
Updated•3 months ago
|
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Pushed by csabou@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/705533ca2ccb Implement String.prototype.replaceAll proposal. r=jorendorff
Comment 4•3 months ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
status-firefox72:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
Comment 5•3 months ago
|
||
Thanks for submitting this, André. We really appreciate it.
You need to log in
before you can comment on or make changes to this bug.
Description
•