Changeset 2772 in webkit for trunk/JavaScriptCore/kjs/identifier.cpp
- Timestamp:
- Nov 19, 2002, 6:35:01 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/identifier.cpp
r2769 r2772 26 26 Identifier Identifier::null; 27 27 28 extern const Identifier argumentsPropertyName("arguments"); 29 extern const Identifier calleePropertyName("callee"); 30 extern const Identifier constructorPropertyName("constructor"); 31 extern const Identifier lengthPropertyName("length"); 32 extern const Identifier messagePropertyName("message"); 33 extern const Identifier namePropertyName("name"); 34 extern const Identifier prototypePropertyName("prototype"); 35 extern const Identifier specialPrototypePropertyName("__proto__"); 36 extern const Identifier toLocaleStringPropertyName("toLocaleString"); 37 extern const Identifier toStringPropertyName("toString"); 38 extern const Identifier valueOfPropertyName("valueOf"); 39 28 40 bool operator==(const Identifier &a, const char *b) 29 41 { … … 31 43 } 32 44 33 void Identifier::aboutToDestroyUStringRep(UString::Rep *)45 UString::Rep *Identifier::add(const char *c) 34 46 { 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 67 UString::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 84 UString::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 92 void Identifier::remove(UString::Rep *) 93 { 94 // Here's where we find the string already in the hash table, and remove it. 35 95 } 36 96
Note:
See TracChangeset
for help on using the changeset viewer.