Ignore:
Timestamp:
Nov 19, 2002, 6:35:01 PM (23 years ago)
Author:
darin
Message:
  • a few more globals for often-used property names
  • conversion to Identifier from UString must now be explicit
  • kjs/error_object.cpp:
  • kjs/function.cpp:
  • kjs/function_object.cpp:
  • kjs/identifier.cpp:
  • kjs/identifier.h:
  • kjs/lexer.cpp:
  • kjs/nodes.cpp:
  • kjs/number_object.cpp:
  • kjs/object.cpp:
  • kjs/object.h:
  • kjs/string_object.cpp:
  • kjs/testkjs.cpp:
  • kjs/ustring.cpp:
  • kjs/ustring.h:
File:
1 edited

Legend:

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

    r2769 r2772  
    2626Identifier Identifier::null;
    2727
     28extern const Identifier argumentsPropertyName("arguments");
     29extern const Identifier calleePropertyName("callee");
     30extern const Identifier constructorPropertyName("constructor");
     31extern const Identifier lengthPropertyName("length");
     32extern const Identifier messagePropertyName("message");
     33extern const Identifier namePropertyName("name");
     34extern const Identifier prototypePropertyName("prototype");
     35extern const Identifier specialPrototypePropertyName("__proto__");
     36extern const Identifier toLocaleStringPropertyName("toLocaleString");
     37extern const Identifier toStringPropertyName("toString");
     38extern const Identifier valueOfPropertyName("valueOf");
     39
    2840bool operator==(const Identifier &a, const char *b)
    2941{
     
    3143}
    3244
    33 void Identifier::aboutToDestroyUStringRep(UString::Rep *)
     45UString::Rep *Identifier::add(const char *c)
    3446{
     47  if (!c)
     48    return &UString::Rep::null;
     49  int length = strlen(c);
     50  if (length == 0)
     51    return &UString::Rep::empty;
     52
     53  // Here's where we compute a hash and find it or put it in the hash table.
     54  UChar *d = new UChar[length];
     55  for (int i = 0; i < length; i++)
     56    d[i] = c[i];
     57
     58  UString::Rep *r = new UString::Rep;
     59  r->dat = d;
     60  r->len = length;
     61  r->capacity = length;
     62  r->rc = 0;
     63  r->_hash = 0;
     64  return r;
     65}
     66
     67UString::Rep *Identifier::add(const UChar *s, int length)
     68{
     69  // Here's where we compute a hash and find it or put it in the hash table.
     70
     71  UChar *d = new UChar[length];
     72  for (int i = 0; i < length; i++)
     73    d[i] = s[i];
     74
     75  UString::Rep *r = new UString::Rep;
     76  r->dat = d;
     77  r->len = length;
     78  r->capacity = length;
     79  r->rc = 0;
     80  r->_hash = 0;
     81  return r;
     82}
     83
     84UString::Rep *Identifier::add(const UString &s)
     85{
     86  // Here's where we compute a hash and find it or put it in the hash table.
     87  // Don't forget to check for the case of a string that's already in the table by looking at capacity.
     88 
     89  return s.rep;
     90}
     91
     92void Identifier::remove(UString::Rep *)
     93{
     94  // Here's where we find the string already in the hash table, and remove it.
    3595}
    3696
Note: See TracChangeset for help on using the changeset viewer.