Changeset 30109 in webkit for trunk/JavaScriptCore/kjs/string_object.cpp
- Timestamp:
- Feb 9, 2008, 10:09:42 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/string_object.cpp
r30040 r30109 534 534 535 535 UString u = s; 536 RegExp* reg; 537 RegExp* tmpReg = 0; 536 RefPtr<RegExp> reg; 538 537 RegExpImp* imp = 0; 539 538 if (a0->isObject() && static_cast<JSObject *>(a0)->inherits(&RegExpImp::info)) { … … 545 544 * replaced with the result of the expression new RegExp(regexp). 546 545 */ 547 reg = tmpReg = new RegExp(a0->toString(exec));546 reg = RegExp::create(a0->toString(exec)); 548 547 } 549 548 RegExpObjectImp* regExpObj = static_cast<RegExpObjectImp*>(exec->lexicalGlobalObject()->regExpConstructor()); 550 549 int pos; 551 550 int matchLength; 552 regExpObj->performMatch(reg , u, 0, pos, matchLength);551 regExpObj->performMatch(reg.get(), u, 0, pos, matchLength); 553 552 JSValue* result; 554 553 if (!(reg->global())) { … … 566 565 lastIndex = pos; 567 566 pos += matchLength == 0 ? 1 : matchLength; 568 regExpObj->performMatch(reg , u, pos, pos, matchLength);567 regExpObj->performMatch(reg.get(), u, pos, pos, matchLength); 569 568 } 570 569 if (imp) … … 579 578 } 580 579 } 581 delete tmpReg;582 580 return result; 583 581 } … … 591 589 592 590 UString u = s; 593 RegExp* reg; 594 RegExp* tmpReg = 0; 595 if (a0->isObject() && static_cast<JSObject *>(a0)->inherits(&RegExpImp::info)) { 596 reg = static_cast<RegExpImp *>(a0)->regExp(); 591 RefPtr<RegExp> reg; 592 if (a0->isObject() && static_cast<JSObject*>(a0)->inherits(&RegExpImp::info)) { 593 reg = static_cast<RegExpImp*>(a0)->regExp(); 597 594 } else { 598 595 /* … … 601 598 * replaced with the result of the expression new RegExp(regexp). 602 599 */ 603 reg = tmpReg = new RegExp(a0->toString(exec));600 reg = RegExp::create(a0->toString(exec)); 604 601 } 605 602 RegExpObjectImp* regExpObj = static_cast<RegExpObjectImp*>(exec->lexicalGlobalObject()->regExpConstructor()); 606 603 int pos; 607 604 int matchLength; 608 regExpObj->performMatch(reg, u, 0, pos, matchLength); 609 delete tmpReg; 605 regExpObj->performMatch(reg.get(), u, 0, pos, matchLength); 610 606 return jsNumber(pos); 611 607 }
Note:
See TracChangeset
for help on using the changeset viewer.