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

Unified Diff: src/objects.h

Issue 2398423002: [regexp] Port RegExp.prototype[@@replace] (Closed)
Patch Set: Smi::kZero 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
« no previous file with comments | « src/js/regexp.js ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index e9f7c14232223b237179b59596a9c48482d4ad16..d24451898061e709b49fe888e804404b48a5208b 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -9484,6 +9484,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);
« no previous file with comments | « src/js/regexp.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698