Bug 613820: Regexp forwards ref in quantified parens test. (r=dmandelin)

This commit is contained in:
Chris Leary 2011-07-06 18:09:45 -07:00
parent cdd7186b5e
commit 27845cee6e
4 changed files with 30 additions and 0 deletions

View File

@ -6,5 +6,8 @@ script empty-lookahead.js
script exec.js
script exec-lastIndex-ToInteger.js
script regress-576828.js
script regress-613820-1.js
script regress-613820-2.js
script regress-613820-3.js
silentfail skip-if(!xulRuntime.shell&&(Android||xulRuntime.OS=="WINNT")) script regress-617935.js
script instance-property-storage-introspection.js

View File

@ -0,0 +1,9 @@
/* Back reference is actually a forwards reference. */
var re = /(\2(a)){2}/;
var str = 'aaa';
var actual = re.exec(str);
var expected = makeExpectedMatch(['aa', 'a', 'a'], 0, str);
checkRegExpMatch(actual, expected);
if (typeof reportCompare === 'function')
reportCompare(true, true);

View File

@ -0,0 +1,9 @@
/* Resetting of inner capture groups across quantified capturing parens. */
var re = /(?:(f)(o)(o)|(b)(a)(r))*/;
var str = 'foobar';
var actual = re.exec(str);
var expected = makeExpectedMatch(['foobar', undefined, undefined, undefined, 'b', 'a', 'r'], 0, str);
checkRegExpMatch(actual, expected);
if (typeof reportCompare === 'function')
reportCompare(true, true);

View File

@ -0,0 +1,9 @@
/* Capture group reset to undefined during second iteration, so backreference doesn't see prior result. */
var re = /(?:^(a)|\1(a)|(ab)){2}/;
var str = 'aab';
var actual = re.exec(str);
var expected = makeExpectedMatch(['aa', undefined, 'a', undefined], 0, str);
checkRegExpMatch(actual, expected);
if (typeof reportCompare === 'function')
reportCompare(true, true);