Changeset 26473 in webkit for trunk/JavaScriptCore/kjs/regexp_object.cpp
- Timestamp:
- Oct 12, 2007, 7:40:05 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/regexp_object.cpp
r21031 r26473 86 86 UString input; 87 87 if (args.isEmpty()) 88 input = regExpObj->get(exec, "input")->toString(exec);88 input = regExpObj->get(exec, exec->propertyNames().input)->toString(exec); 89 89 else 90 90 input = args[0]->toString(exec); 91 91 92 double lastIndex = thisObj->get(exec, "lastIndex")->toInteger(exec);93 94 bool globalFlag = thisObj->get(exec, "global")->toBoolean(exec);92 double lastIndex = thisObj->get(exec, exec->propertyNames().lastIndex)->toInteger(exec); 93 94 bool globalFlag = thisObj->get(exec, exec->propertyNames().global)->toBoolean(exec); 95 95 if (!globalFlag) 96 96 lastIndex = 0; 97 97 if (lastIndex < 0 || lastIndex > input.size()) { 98 thisObj->put(exec, "lastIndex", jsNumber(0), DontDelete | DontEnum);98 thisObj->put(exec, exec->propertyNames().lastIndex, jsNumber(0), DontDelete | DontEnum); 99 99 return jsNull(); 100 100 } … … 111 111 if (didMatch) { 112 112 if (globalFlag) 113 thisObj->put(exec, "lastIndex", jsNumber(foundIndex + match.size()), DontDelete | DontEnum);113 thisObj->put(exec, exec->propertyNames().lastIndex, jsNumber(foundIndex + match.size()), DontDelete | DontEnum); 114 114 return regExpObj->arrayOfMatches(exec, match); 115 115 } else { 116 116 if (globalFlag) 117 thisObj->put(exec, "lastIndex", jsNumber(0), DontDelete | DontEnum);117 thisObj->put(exec, exec->propertyNames().lastIndex, jsNumber(0), DontDelete | DontEnum); 118 118 return jsNull(); 119 119 } … … 121 121 break; 122 122 case ToString: 123 UString result = "/" + thisObj->get(exec, "source")->toString(exec) + "/";124 if (thisObj->get(exec, "global")->toBoolean(exec)) {123 UString result = "/" + thisObj->get(exec, exec->propertyNames().source)->toString(exec) + "/"; 124 if (thisObj->get(exec, exec->propertyNames().global)->toBoolean(exec)) { 125 125 result += "g"; 126 126 } 127 if (thisObj->get(exec, "ignoreCase")->toBoolean(exec)) {127 if (thisObj->get(exec, exec->propertyNames().ignoreCase)->toBoolean(exec)) { 128 128 result += "i"; 129 129 } 130 if (thisObj->get(exec, "multiline")->toBoolean(exec)) {130 if (thisObj->get(exec, exec->propertyNames().multiline)->toBoolean(exec)) { 131 131 result += "m"; 132 132 } … … 245 245 } 246 246 JSObject *arr = exec->lexicalInterpreter()->builtinArray()->construct(exec, list); 247 arr->put(exec, "index", jsNumber(d->lastOvector[0]));248 arr->put(exec, "input", jsString(d->lastInput));247 arr->put(exec, exec->propertyNames().index, jsNumber(d->lastOvector[0])); 248 arr->put(exec, exec->propertyNames().input, jsString(d->lastInput)); 249 249 return arr; 250 250 } … … 392 392 bool multiline = (flags.find("m") >= 0); 393 393 394 dat->putDirect( "global", jsBoolean(global), DontDelete | ReadOnly | DontEnum);395 dat->putDirect( "ignoreCase", jsBoolean(ignoreCase), DontDelete | ReadOnly | DontEnum);396 dat->putDirect( "multiline", jsBoolean(multiline), DontDelete | ReadOnly | DontEnum);397 398 dat->putDirect( "source", jsString(p), DontDelete | ReadOnly | DontEnum);399 dat->putDirect( "lastIndex", jsNumber(0), DontDelete | DontEnum);394 dat->putDirect(exec->propertyNames().global, jsBoolean(global), DontDelete | ReadOnly | DontEnum); 395 dat->putDirect(exec->propertyNames().ignoreCase, jsBoolean(ignoreCase), DontDelete | ReadOnly | DontEnum); 396 dat->putDirect(exec->propertyNames().multiline, jsBoolean(multiline), DontDelete | ReadOnly | DontEnum); 397 398 dat->putDirect(exec->propertyNames().source, jsString(p), DontDelete | ReadOnly | DontEnum); 399 dat->putDirect(exec->propertyNames().lastIndex, jsNumber(0), DontDelete | DontEnum); 400 400 401 401 int reflags = RegExp::None;
Note:
See TracChangeset
for help on using the changeset viewer.