Changeset 11034 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Nov 3, 2005, 10:11:58 AM (20 years ago)
Author:
ggaren
Message:

Reviewed by darin.

We now update lastIndex relative to the start of the last match,
rather than the start of the last search. We used to assume that
the two were equal, but that may not be the case in $ matches.

  • kjs/regexp_object.cpp: (RegExpProtoFuncImp::callAsFunction):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/regexp_object.cpp

    r10818 r11034  
    110110    }
    111111
    112     UString match = regExpObj->performMatch(regExp, input, static_cast<int>(lastIndex));
     112    int foundIndex;
     113    UString match = regExpObj->performMatch(regExp, input, static_cast<int>(lastIndex), &foundIndex);
    113114    bool didMatch = !match.isNull();
    114115
     
    120121    if (didMatch) {
    121122      if (globalFlag)
    122         thisObj->put(exec, "lastIndex", Number(lastIndex + match.size()), DontDelete | DontEnum);
     123        thisObj->put(exec, "lastIndex", Number(foundIndex + match.size()), DontDelete | DontEnum);
    123124      return regExpObj->arrayOfMatches(exec, match);
    124125    } else {
Note: See TracChangeset for help on using the changeset viewer.