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

Unified Diff: src/regexp-delay.js

Issue 48061: Remapped regexp last-match-info to put subject and index before match indices. (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/macros.py ('k') | src/string.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp-delay.js
diff --git a/src/regexp-delay.js b/src/regexp-delay.js
index e80c39f23e5a1a5cc95f41b417d2f8d95a036fb6..3362e88412b06b5e067aa117d8007084938bbc2f 100644
--- a/src/regexp-delay.js
+++ b/src/regexp-delay.js
@@ -300,7 +300,7 @@ function RegExpGetRightContext() {
// The properties $1..$9 are the first nine capturing substrings of the last
// successful match, or ''. The function RegExpMakeCaptureGetter will be
-// called with indeces from 1 to 9.
+// called with indices from 1 to 9.
function RegExpMakeCaptureGetter(n) {
return function() {
var index = n * 2;
@@ -321,10 +321,10 @@ function RegExpMakeCaptureGetter(n) {
// the subject string for the last successful match.
var lastMatchInfo = [
2, // REGEXP_NUMBER_OF_CAPTURES
- 0, // REGEXP_FIRST_CAPTURE + 0
- 0, // REGEXP_FIRST_CAPTURE + 1
"", // Last subject.
void 0, // Last input - settable with RegExpSetInput.
+ 0, // REGEXP_FIRST_CAPTURE + 0
+ 0, // REGEXP_FIRST_CAPTURE + 1
];
// -------------------------------------------------------------------
@@ -353,8 +353,7 @@ function SetupRegExp() {
return IS_UNDEFINED(regExpInput) ? "" : regExpInput;
}
function RegExpSetInput(string) {
- lastMatchInfo[lastMatchInfo[REGEXP_NUMBER_OF_CAPTURES] + 2] =
- ToString(string);
+ LAST_INPUT(lastMatchInfo) = ToString(string);
Erik Corry 2009/03/17 12:39:32 This is much prettier, thanks!
};
// All these accessors are set with the 'never_used' flag set to true.
« no previous file with comments | « src/macros.py ('k') | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698