Ignore:
Timestamp:
Oct 12, 2007, 7:40:05 AM (18 years ago)
Author:
oliver
Message:

Reviewed by Mark.

  • kjs/CommonIdentifiers.h:
  • kjs/regexp_object.cpp: (RegExpProtoFunc::callAsFunction): (RegExpObjectImp::arrayOfMatches): (RegExpObjectImp::construct):
File:
1 edited

Legend:

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

    r21031 r26473  
    8686    UString input;
    8787    if (args.isEmpty())
    88       input = regExpObj->get(exec, "input")->toString(exec);
     88      input = regExpObj->get(exec, exec->propertyNames().input)->toString(exec);
    8989    else
    9090      input = args[0]->toString(exec);
    9191
    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);
    9595    if (!globalFlag)
    9696      lastIndex = 0;
    9797    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);
    9999      return jsNull();
    100100    }
     
    111111    if (didMatch) {
    112112      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);
    114114      return regExpObj->arrayOfMatches(exec, match);
    115115    } else {
    116116      if (globalFlag)
    117         thisObj->put(exec, "lastIndex", jsNumber(0), DontDelete | DontEnum);
     117        thisObj->put(exec, exec->propertyNames().lastIndex, jsNumber(0), DontDelete | DontEnum);
    118118      return jsNull();
    119119    }
     
    121121  break;
    122122  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)) {
    125125      result += "g";
    126126    }
    127     if (thisObj->get(exec, "ignoreCase")->toBoolean(exec)) {
     127    if (thisObj->get(exec, exec->propertyNames().ignoreCase)->toBoolean(exec)) {
    128128      result += "i";
    129129    }
    130     if (thisObj->get(exec, "multiline")->toBoolean(exec)) {
     130    if (thisObj->get(exec, exec->propertyNames().multiline)->toBoolean(exec)) {
    131131      result += "m";
    132132    }
     
    245245    }
    246246  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));
    249249  return arr;
    250250}
     
    392392  bool multiline = (flags.find("m") >= 0);
    393393
    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);
    400400
    401401  int reflags = RegExp::None;
Note: See TracChangeset for help on using the changeset viewer.