Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: src/objects.cc

Issue 2776293003: Revert of [regexp] Named capture support for string replacements (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-regexp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 7b9923d1bcd29cd5a1cfdd68901fd6e0d763260e..d4185029dec568d67468947cd1e90ffd5bc3a297 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -11403,8 +11403,6 @@
MaybeHandle<String> String::GetSubstitution(Isolate* isolate, Match* match,
Handle<String> replacement) {
- DCHECK_IMPLIES(match->HasNamedCaptures(), FLAG_harmony_regexp_named_captures);
-
Factory* factory = isolate->factory();
const int replacement_length = replacement->length();
@@ -11491,37 +11489,6 @@
continue_from_ix = peek_ix + advance;
break;
}
- case '<': { // $<name> - named capture
- if (!match->HasNamedCaptures()) {
- builder.AppendCharacter('$');
- continue_from_ix = peek_ix;
- break;
- }
-
- Handle<String> bracket_string =
- factory->LookupSingleCharacterStringFromCode('>');
- const int closing_bracket_ix =
- String::IndexOf(isolate, replacement, bracket_string, peek_ix + 1);
-
- if (closing_bracket_ix == -1) {
- THROW_NEW_ERROR(
- isolate,
- NewSyntaxError(MessageTemplate::kRegExpInvalidReplaceString,
- replacement),
- String);
- }
-
- Handle<String> capture_name =
- factory->NewSubString(replacement, peek_ix + 1, closing_bracket_ix);
- bool capture_exists;
- Handle<String> capture;
- ASSIGN_RETURN_ON_EXCEPTION(
- isolate, capture,
- match->GetNamedCapture(capture_name, &capture_exists), String);
- if (capture_exists) builder.AppendString(capture);
- continue_from_ix = closing_bracket_ix + 1;
- break;
- }
default:
builder.AppendCharacter('$');
continue_from_ix = peek_ix;
@@ -11692,15 +11659,6 @@
return (allow_prefix_match || i == slen) && remaining_in_str == 0;
}
-template <>
-bool String::IsEqualTo(Vector<const uint8_t> str) {
- return IsOneByteEqualTo(str);
-}
-
-template <>
-bool String::IsEqualTo(Vector<const uc16> str) {
- return IsTwoByteEqualTo(str);
-}
bool String::IsOneByteEqualTo(Vector<const uint8_t> str) {
int slen = length();
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698