Changeset 2766 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Nov 19, 2002, 3:45:44 PM (23 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/function.cpp
r2760 r2766 174 174 if (!s.isEmpty()) 175 175 s += ", "; 176 s += (*p)->name ;176 s += (*p)->name.ustring(); 177 177 p = &(*p)->next; 178 178 } -
trunk/JavaScriptCore/kjs/function_object.cpp
r2760 r2766 95 95 DeclaredFunctionImp *fi = static_cast<DeclaredFunctionImp*> 96 96 (thisObj.imp()); 97 return String("function " + fi->name() + "(" +97 return String("function " + fi->name().ustring() + "(" + 98 98 fi->parameterString() + ") " + fi->body->toString()); 99 99 } else if (thisObj.inherits(&FunctionImp::info) && 100 100 !static_cast<FunctionImp*>(thisObj.imp())->name().isNull()) { 101 result = String("function " + static_cast<FunctionImp*>(thisObj.imp())->name() + "()");101 result = String("function " + static_cast<FunctionImp*>(thisObj.imp())->name().ustring() + "()"); 102 102 } 103 103 else { -
trunk/JavaScriptCore/kjs/identifier.cpp
r2760 r2766 22 22 #include "identifier.h" 23 23 24 namespace KJS { 25 26 Identifier Identifier::null; 27 28 bool operator==(const Identifier &a, const char *b) 29 { 30 return a._ustring == b; 31 } 32 33 } // namespace KJS -
trunk/JavaScriptCore/kjs/identifier.h
r2760 r2766 27 27 namespace KJS { 28 28 29 class Identifier : public UString { 30 public: 31 Identifier() { } 32 Identifier(const char *s) : UString(s) { } 33 Identifier(const UString &s) : UString(s) { } 34 }; 29 class Identifier { 30 friend class PropertyMap; 31 public: 32 Identifier() { } 33 Identifier(const char *s) : _ustring(s) { } 34 Identifier(const UString &s) : _ustring(s) { } 35 36 const UString &ustring() const { return _ustring; } 37 DOM::DOMString string() const; 38 QString qstring() const; 39 40 const UChar *data() const { return _ustring.data(); } 41 int size() const { return _ustring.size(); } 42 43 const char *ascii() const { return _ustring.ascii(); } 44 45 static Identifier from(unsigned y) { return UString::from(y); } 46 47 bool isNull() const { return _ustring.isNull(); } 48 bool isEmpty() const { return _ustring.isEmpty(); } 49 50 unsigned long toULong(bool *ok) const { return _ustring.toULong(ok); } 51 double toDouble() const { return _ustring.toDouble(); } 52 53 static Identifier null; 54 55 friend bool operator==(const Identifier &, const Identifier &); 56 friend bool operator!=(const Identifier &, const Identifier &); 57 58 friend bool operator==(const Identifier &, const char *); 59 60 private: 61 UString _ustring; 62 }; 63 64 inline bool operator==(const Identifier &a, const Identifier &b) 65 { 66 return a._ustring == b._ustring; 67 } 68 69 inline bool operator!=(const Identifier &a, const Identifier &b) 70 { 71 return a._ustring != b._ustring; 72 } 35 73 36 74 } -
trunk/JavaScriptCore/kjs/nodes.cpp
r2760 r2766 461 461 if (str.isNull()) { 462 462 s = String(UString::from(numeric)); 463 } else 464 s = String(str); 463 } else { 464 s = String(str.ustring()); 465 } 465 466 466 467 return s; … … 1637 1638 variable.put(exec, ident, val, DontDelete | Internal); 1638 1639 1639 return String(ident );1640 return String(ident.ustring()); 1640 1641 } 1641 1642 … … 2099 2100 Reference ref = lexpr->evaluateReference(exec); 2100 2101 KJS_CHECKEXCEPTION 2101 ref.putValue(exec, String(name));2102 ref.putValue(exec, String(name.ustring())); 2102 2103 2103 2104 c = statement->execute(exec); -
trunk/JavaScriptCore/kjs/nodes2string.cpp
r1799 r2766 34 34 35 35 UString toString() const { return str; } 36 SourceStream& operator<<(const KJS::UString &); 36 SourceStream& operator<<(const Identifier &); 37 SourceStream& operator<<(const UString &); 38 SourceStream& operator<<(const char *); 37 39 SourceStream& operator<<(char); 38 40 SourceStream& operator<<(Format f); … … 52 54 } 53 55 54 SourceStream& SourceStream::operator<<(const KJS::UString &s) 56 SourceStream& SourceStream::operator<<(const char *s) 57 { 58 str += UString(s); 59 return *this; 60 } 61 62 SourceStream& SourceStream::operator<<(const UString &s) 55 63 { 56 64 str += s; 65 return *this; 66 } 67 68 SourceStream& SourceStream::operator<<(const Identifier &s) 69 { 70 str += s.ustring(); 57 71 return *this; 58 72 } -
trunk/JavaScriptCore/kjs/property_map.cpp
r2760 r2766 98 98 if (!_table) { 99 99 UString::Rep *key = _singleEntry.key; 100 if (key && keysMatch(name. rep, key)) {100 if (key && keysMatch(name._ustring.rep, key)) { 101 101 attributes = _singleEntry.attributes; 102 102 return _singleEntry.value; … … 105 105 } 106 106 107 int i = hash(name. rep);107 int i = hash(name._ustring.rep); 108 108 while (UString::Rep *key = _table[i].key) { 109 if (keysMatch(name. rep, key)) {109 if (keysMatch(name._ustring.rep, key)) { 110 110 attributes = _table[i].attributes; 111 111 return _table[i].value; … … 120 120 if (!_table) { 121 121 UString::Rep *key = _singleEntry.key; 122 if (key && keysMatch(name. rep, key))122 if (key && keysMatch(name._ustring.rep, key)) 123 123 return _singleEntry.value; 124 124 return 0; 125 125 } 126 126 127 int i = hash(name. rep);127 int i = hash(name._ustring.rep); 128 128 while (UString::Rep *key = _table[i].key) { 129 if (keysMatch(name. rep, key))129 if (keysMatch(name._ustring.rep, key)) 130 130 return _table[i].value; 131 131 i = (i + 1) & _tableSizeHashMask; … … 139 139 UString::Rep *key = _singleEntry.key; 140 140 if (key) { 141 if (keysMatch(name. rep, key)) {141 if (keysMatch(name._ustring.rep, key)) { 142 142 _singleEntry.value = value; 143 143 return; 144 144 } 145 145 } else { 146 name. rep->ref();147 _singleEntry.key = name. rep;146 name._ustring.rep->ref(); 147 _singleEntry.key = name._ustring.rep; 148 148 _singleEntry.value = value; 149 149 _singleEntry.attributes = attributes; … … 156 156 expand(); 157 157 158 int i = hash(name. rep);158 int i = hash(name._ustring.rep); 159 159 while (UString::Rep *key = _table[i].key) { 160 if (keysMatch(name. rep, key)) {160 if (keysMatch(name._ustring.rep, key)) { 161 161 // Put a new value in an existing hash table entry. 162 162 _table[i].value = value; … … 168 168 169 169 // Create a new hash table entry. 170 name. rep->ref();171 _table[i].key = name. rep;170 name._ustring.rep->ref(); 171 _table[i].key = name._ustring.rep; 172 172 _table[i].value = value; 173 173 _table[i].attributes = attributes; … … 216 216 if (!_table) { 217 217 key = _singleEntry.key; 218 if (key && keysMatch(name. rep, key)) {218 if (key && keysMatch(name._ustring.rep, key)) { 219 219 key->deref(); 220 220 _singleEntry.key = 0; … … 225 225 226 226 // Find the thing to remove. 227 int i = hash(name. rep);227 int i = hash(name._ustring.rep); 228 228 while ((key = _table[i].key)) { 229 if (keysMatch(name. rep, key))229 if (keysMatch(name._ustring.rep, key)) 230 230 break; 231 231 i = (i + 1) & _tableSizeHashMask; -
trunk/JavaScriptCore/kjs/reference.cpp
r2760 r2766 106 106 107 107 if (o.isNull() || o.type() == NullType) { 108 UString m = I18N_NOOP("Can't find variable: ") + getPropertyName(exec) ;108 UString m = I18N_NOOP("Can't find variable: ") + getPropertyName(exec).ustring(); 109 109 Object err = Error::create(exec, ReferenceError, m.ascii()); 110 110 exec->setException(err); -
trunk/JavaScriptCore/kjs/regexp_object.cpp
r2760 r2766 196 196 Value RegExpObjectImp::get(ExecState *exec, const Identifier &p) const 197 197 { 198 if (p[0] == '$' && lastOvector) 198 UString s = p.ustring(); 199 if (s[0] == '$' && lastOvector) 199 200 { 200 201 bool ok; 201 unsigned long i = p.substr(1).toULong(&ok);202 unsigned long i = s.substr(1).toULong(&ok); 202 203 if (ok) 203 204 {
Note:
See TracChangeset
for help on using the changeset viewer.