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

Unified Diff: src/regexp.js

Issue 1513004: Revert svn r4269. (Closed)
Patch Set: Created 10 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 | « no previous file | src/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp.js
diff --git a/src/regexp.js b/src/regexp.js
index dc1b0429f7094c5c4fe80d5af5515c8fd2e5fb91..e2492f7245b24ba8d1082d0bbcf94a99e309add7 100644
--- a/src/regexp.js
+++ b/src/regexp.js
@@ -344,7 +344,6 @@ function RegExpToString() {
// on the captures array of the last successful match and the subject string
// of the last successful match.
function RegExpGetLastMatch() {
- if (lastMatchInfoOverride) { return lastMatchInfoOverride[0]; }
var regExpSubject = LAST_SUBJECT(lastMatchInfo);
return SubString(regExpSubject,
lastMatchInfo[CAPTURE0],
@@ -353,11 +352,6 @@ function RegExpGetLastMatch() {
function RegExpGetLastParen() {
- if (lastMatchInfoOverride) {
- var override = lastMatchInfoOverride;
- if (override.length <= 3) return '';
- return override[override.length - 3];
- }
var length = NUMBER_OF_CAPTURES(lastMatchInfo);
if (length <= 2) return ''; // There were no captures.
// We match the SpiderMonkey behavior: return the substring defined by the
@@ -374,32 +368,17 @@ function RegExpGetLastParen() {
function RegExpGetLeftContext() {
- var start_index;
- var subject;
- if (!lastMatchInfoOverride) {
- start_index = lastMatchInfo[CAPTURE0];
- subject = LAST_SUBJECT(lastMatchInfo);
- } else {
- var override = lastMatchInfoOverride;
- start_index = override[override.length - 2];
- subject = override[override.length - 1];
- }
- return SubString(subject, 0, start_index);
+ return SubString(LAST_SUBJECT(lastMatchInfo),
+ 0,
+ lastMatchInfo[CAPTURE0]);
}
function RegExpGetRightContext() {
- var start_index;
- var subject;
- if (!lastMatchInfoOverride) {
- start_index = lastMatchInfo[CAPTURE1];
- subject = LAST_SUBJECT(lastMatchInfo);
- } else {
- var override = lastMatchInfoOverride;
- subject = override[override.length - 1];
- start_index = override[override.length - 2] + subject.length;
- }
- return SubString(subject, start_index, subject.length);
+ var subject = LAST_SUBJECT(lastMatchInfo);
+ return SubString(subject,
+ lastMatchInfo[CAPTURE1],
+ subject.length);
}
@@ -408,10 +387,6 @@ function RegExpGetRightContext() {
// called with indices from 1 to 9.
function RegExpMakeCaptureGetter(n) {
return function() {
- if (lastMatchInfoOverride) {
- if (n < lastMatchInfoOverride.length - 2) return lastMatchInfoOverride[n];
- return '';
- }
var index = n * 2;
if (index >= NUMBER_OF_CAPTURES(lastMatchInfo)) return '';
var matchStart = lastMatchInfo[CAPTURE(index)];
@@ -436,12 +411,6 @@ var lastMatchInfo = [
0, // REGEXP_FIRST_CAPTURE + 1
];
-// Override last match info with an array of actual substrings.
-// Used internally by replace regexp with function.
-// The array has the format of an "apply" argument for a replacement
-// function.
-var lastMatchInfoOverride = null;
-
// -------------------------------------------------------------------
function SetupRegExp() {
« no previous file with comments | « no previous file | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698