[esnext] Ship String.p.matchAll/RegExp.p.[@@matchAll]
Enable --harmony-string-matchall by default. String.prototype.matchAll behaves similarly to String.prototype.match, but returns a full regexp result object for each match in a global or sticky regexp. This offers a simple way to iterate over matches when access to e.g. capture groups is needed. const string = 'a b c'; const regex = /[ac]/g; for (const match of string.matchAll(regex)) { console.log(`${match[0]} at ${match.index}`); } // a at 0 // c at 4 More information can be found here: https://github.com/tc39/proposal-string-matchall Drive-by: Update debug evaluate side effect expectations to handle String.p.matchAll and RegExp.p[@@matchAll] Bug: v8:6890 Change-Id: Ie3e712af66689936b7d2a15df705b792ccf06bd3 Reviewed-on: https://chromium-review.googlesource.com/c/1377774 Reviewed-by: Mathias Bynens <mathias@chromium.org> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Peter Wong <peter.wm.wong@gmail.com> Cr-Commit-Position: refs/heads/master@{#58250}
This commit is contained in:
parent
a43fa12a8c
commit
76cb4fe626
@ -749,6 +749,7 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtins::Name id) {
|
||||
case Builtins::kStringPrototypeItalics:
|
||||
case Builtins::kStringPrototypeLastIndexOf:
|
||||
case Builtins::kStringPrototypeLink:
|
||||
case Builtins::kStringPrototypeMatchAll:
|
||||
case Builtins::kStringPrototypePadEnd:
|
||||
case Builtins::kStringPrototypePadStart:
|
||||
case Builtins::kStringPrototypeRepeat:
|
||||
@ -834,6 +835,7 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtins::Name id) {
|
||||
case Builtins::kRegExpPrototypeFlagsGetter:
|
||||
case Builtins::kRegExpPrototypeGlobalGetter:
|
||||
case Builtins::kRegExpPrototypeIgnoreCaseGetter:
|
||||
case Builtins::kRegExpPrototypeMatchAll:
|
||||
case Builtins::kRegExpPrototypeMultilineGetter:
|
||||
case Builtins::kRegExpPrototypeDotAllGetter:
|
||||
case Builtins::kRegExpPrototypeUnicodeGetter:
|
||||
|
@ -219,7 +219,6 @@ DEFINE_IMPLICATION(harmony_private_methods, harmony_private_fields)
|
||||
#define HARMONY_STAGED_BASE(V) \
|
||||
V(harmony_private_fields, "harmony private fields in class literals") \
|
||||
V(harmony_numeric_separator, "harmony numeric separator between digits") \
|
||||
V(harmony_string_matchall, "harmony String.prototype.matchAll") \
|
||||
V(harmony_object_from_entries, "harmony Object.fromEntries()")
|
||||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
@ -243,7 +242,8 @@ DEFINE_IMPLICATION(harmony_private_methods, harmony_private_fields)
|
||||
V(harmony_global, "harmony global") \
|
||||
V(harmony_json_stringify, "well-formed JSON.stringify") \
|
||||
V(harmony_public_fields, "harmony public instance fields in class literals") \
|
||||
V(harmony_static_fields, "harmony static fields in class literals")
|
||||
V(harmony_static_fields, "harmony static fields in class literals") \
|
||||
V(harmony_string_matchall, "harmony String.prototype.matchAll")
|
||||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
#define HARMONY_SHIPPING(V) \
|
||||
|
@ -182,6 +182,7 @@ function listener(event, exec_state, event_data, data) {
|
||||
}
|
||||
if (f == "normalize") continue;
|
||||
if (f == "match") continue;
|
||||
if (f == "matchAll") continue;
|
||||
if (f == "search") continue;
|
||||
if (f == "split" || f == "replace") {
|
||||
fail(`'abcd'.${f}(2)`);
|
||||
|
Loading…
Reference in New Issue
Block a user