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

Unified Diff: src/string.js

Issue 53047: Implement string.match in C++. (Closed)
Patch Set: Created 11 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/runtime.cc ('k') | test/mjsunit/regexp-indexof.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/string.js
diff --git a/src/string.js b/src/string.js
index 18ef3d88bde20e9e770015102230d6a449afa824..55943846b9784dec26ff3d02c6da9976996f1448 100644
--- a/src/string.js
+++ b/src/string.js
@@ -157,21 +157,8 @@ function StringMatch(regexp) {
if (!regexp.global) return regexp.exec(subject);
%_Log('regexp', 'regexp-match,%0S,%1r', [subject, regexp]);
- var matches = DoRegExpExecGlobal(regexp, subject);
-
- // If the regexp did not match, return null.
- if (matches.length == 0) return null;
-
- // Build the result array.
- var result = new $Array(match_string);
- for (var i = 0; i < matches.length; ++i) {
- var matchInfo = matches[i];
- var match_string = subject.slice(matchInfo[CAPTURE0],
- matchInfo[CAPTURE1]);
- result[i] = match_string;
- }
-
- return result;
+ // lastMatchInfo is defined in regexp-delay.js
Erik Corry 2009/03/25 11:29:46 full stop
+ return %StringMatch(subject, regexp, lastMatchInfo);
}
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/regexp-indexof.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698