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

Unified Diff: src/regexp.js

Issue 3745005: Fix bug in cache handling of lastIndex on global regexps. (Closed)
Patch Set: Remove leftover crud from test. Created 10 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 | test/mjsunit/regress/regress-58740.js » ('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 faa525d62da27ca518e3b4fa8ec12f6ab2cbdaa8..59c40407fbc20ddc4406d0ef2661d7d9bcf39099 100644
--- a/src/regexp.js
+++ b/src/regexp.js
@@ -186,10 +186,10 @@ function RegExpExec(string) {
%_IsRegExpEquivalent(cache.regExp, this) &&
%_ObjectEquals(cache.subject, string)) {
if (cache.answerSaved) {
- // If this regexp is not global, cache.lastIndex is zero, so we only get
+ // If this regexp is global, cache.lastIndex is zero, so we only get
// here if this.lastIndex is zero, and resulting this.lastIndex
// must be zero too, so no change is necessary.
- if (this.global) this.lastIndex = lastMatchInfo[CAPTURE1];
+ if (!this.global) this.lastIndex = lastMatchInfo[CAPTURE1];
return %_RegExpCloneResult(cache.answer);
} else {
saveAnswer = true;
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-58740.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698