Changeset 35807 in webkit for trunk/JavaScriptCore/kjs/RegExpObject.cpp
- Timestamp:
- Aug 17, 2008, 1:23:49 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/RegExpObject.cpp
r35291 r35807 31 31 namespace KJS { 32 32 33 ASSERT_CLASS_FITS_IN_CELL(RegExpObject); 34 33 35 const ClassInfo RegExpObject::info = { "RegExp", 0, 0, ExecState::regExpTable }; 34 36 … … 45 47 RegExpObject::RegExpObject(RegExpPrototype* regExpPrototype, PassRefPtr<RegExp> regExp) 46 48 : JSObject(regExpPrototype) 47 , m_regExp(regExp) 48 , m_lastIndex(0) 49 , d(new RegExpObjectData(regExp, 0)) 49 50 { 50 51 } … … 63 64 switch (token) { 64 65 case Global: 65 return jsBoolean( m_regExp->global());66 return jsBoolean(d->regExp->global()); 66 67 case IgnoreCase: 67 return jsBoolean( m_regExp->ignoreCase());68 return jsBoolean(d->regExp->ignoreCase()); 68 69 case Multiline: 69 return jsBoolean( m_regExp->multiline());70 return jsBoolean(d->regExp->multiline()); 70 71 case Source: 71 return jsString(exec, m_regExp->pattern());72 return jsString(exec, d->regExp->pattern()); 72 73 case LastIndex: 73 return jsNumber(exec, m_lastIndex);74 return jsNumber(exec, d->lastIndex); 74 75 } 75 76 … … 87 88 UNUSED_PARAM(token); 88 89 ASSERT(token == LastIndex); 89 m_lastIndex = value->toInteger(exec);90 d->lastIndex = value->toInteger(exec); 90 91 } 91 92 … … 108 109 int lastIndex = 0; 109 110 if (global) { 110 if ( m_lastIndex < 0 || m_lastIndex > input.size()) {111 m_lastIndex = 0;111 if (d->lastIndex < 0 || d->lastIndex > input.size()) { 112 d->lastIndex = 0; 112 113 return false; 113 114 } 114 lastIndex = static_cast<int>( m_lastIndex);115 lastIndex = static_cast<int>(d->lastIndex); 115 116 } 116 117 117 118 int foundIndex; 118 119 int foundLength; 119 regExpObj->performMatch( m_regExp.get(), input, lastIndex, foundIndex, foundLength);120 regExpObj->performMatch(d->regExp.get(), input, lastIndex, foundIndex, foundLength); 120 121 121 122 if (global) { 122 123 lastIndex = foundIndex < 0 ? 0 : foundIndex + foundLength; 123 m_lastIndex = lastIndex;124 d->lastIndex = lastIndex; 124 125 } 125 126
Note:
See TracChangeset
for help on using the changeset viewer.