The code in RegExpImpl.findReplen did not take into account that a particular
parenthesis pair can be null if it is not captured. The patch fixes that to
send undefined to the replace function for that case.
This commit is contained in:
igor%mir2.org 2003-09-01 09:05:52 +00:00
Родитель 828f431d53
Коммит 2aa340aba8
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -483,7 +483,11 @@ class ReplaceData extends GlobData {
args[0] = reImpl.lastMatch.toString();
for (int i=0; i < parenCount; i++) {
SubString sub = (SubString) parens.get(i);
args[i+1] = sub.toString();
if (sub != null) {
args[i+1] = sub.toString();
} else {
args[i+1] = Undefined.instance;
}
}
args[parenCount+1] = new Integer(reImpl.leftContext.length);
args[parenCount+2] = str;