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

Unified Diff: src/objects.h

Issue 2398423002: [regexp] Port RegExp.prototype[@@replace] (Closed)
Patch Set: Tweaks in string code-stub-assembler methods Created 4 years, 2 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
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index e63bf3531715fce43c4a8da35c8ca28c04a8466c..701e821e8a4120eddf9cb114fd1b38ac59f8a2a5 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -9415,6 +9415,25 @@ class String: public Name {
static Object* LastIndexOf(Isolate* isolate, Handle<Object> receiver,
Handle<Object> search, Handle<Object> position);
+ // Encapsulates logic related to a match and its capture groups as required
+ // by GetSubstitution.
+ class Match {
+ public:
+ virtual Handle<String> GetMatch() = 0;
+ virtual MaybeHandle<String> GetCapture(int i, bool* capture_exists) = 0;
+ virtual Handle<String> GetPrefix() = 0;
+ virtual Handle<String> GetSuffix() = 0;
+ virtual int CaptureCount() = 0;
+ virtual ~Match() {}
+ };
+
+ // ES#sec-getsubstitution
+ // GetSubstitution(matched, str, position, captures, replacement)
+ // Expand the $-expressions in the string and return a new string with
+ // the result.
+ MUST_USE_RESULT static MaybeHandle<String> GetSubstitution(
+ Isolate* isolate, Match* match, Handle<String> replacement);
+
// String equality operations.
inline bool Equals(String* other);
inline static bool Equals(Handle<String> one, Handle<String> two);

Powered by Google App Engine
This is Rietveld 408576698