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

Unified Diff: src/runtime/runtime-regexp.cc

Issue 2422563002: [regexp] Simplify GetCapture (Closed)
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-regexp.cc
diff --git a/src/runtime/runtime-regexp.cc b/src/runtime/runtime-regexp.cc
index 986c7365ef46692b035b64bb3ecc6fa813346778..bb70e46164b783f0399e6525bc8772c12d00edcb 100644
--- a/src/runtime/runtime-regexp.cc
+++ b/src/runtime/runtime-regexp.cc
@@ -901,14 +901,10 @@ class MatchInfoBackedMatch : public String::Match {
}
MaybeHandle<String> GetCapture(int i, bool* capture_exists) override {
- Handle<Object> capture_obj =
- RegExpUtils::GenericCaptureGetter(isolate_, match_info_, i);
- if (capture_obj->IsUndefined(isolate_)) {
- *capture_exists = false;
- return isolate_->factory()->empty_string();
- }
- *capture_exists = true;
- return Object::ToString(isolate_, capture_obj);
+ Handle<Object> capture_obj = RegExpUtils::GenericCaptureGetter(
+ isolate_, match_info_, i, capture_exists);
+ return (*capture_exists) ? Object::ToString(isolate_, capture_obj)
+ : isolate_->factory()->empty_string();
}
Handle<String> GetPrefix() override {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698