Changeset 10207 in webkit for trunk/JavaScriptCore/kjs/object.cpp
- Timestamp:
- Aug 15, 2005, 5:47:46 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/object.cpp
r10084 r10207 89 89 if (++depth > KJS_MAX_STACK) { 90 90 --depth; 91 ObjectImp *err = Error::create(exec, RangeError, 92 "Maximum call stack size exceeded."); 93 exec->setException(err); 94 return err; 91 return throwError(exec, RangeError, "Maximum call stack size exceeded."); 95 92 } 96 93 #endif … … 168 165 169 166 return Undefined(); 170 }171 172 bool ObjectImp::getProperty(ExecState *exec, const Identifier& propertyName, ValueImp*& result) const173 {174 PropertySlot slot;175 if (const_cast<ObjectImp *>(this)->getPropertySlot(exec, propertyName, slot)) {176 result = slot.getValue(exec, propertyName);177 return true;178 }179 180 return false;181 }182 183 bool ObjectImp::getProperty(ExecState *exec, unsigned propertyName, ValueImp*& result) const184 {185 PropertySlot slot;186 if (const_cast<ObjectImp *>(this)->getPropertySlot(exec, propertyName, slot)) {187 result = slot.getValue(exec, propertyName);188 return true;189 }190 191 return false;192 167 } 193 168 … … 278 253 } 279 254 280 bool ObjectImp::hasOwnProperty(ExecState *exec, const Identifier &propertyName) const281 {282 PropertySlot slot;283 return const_cast<ObjectImp *>(this)->getOwnPropertySlot(exec, propertyName, slot);284 }285 286 bool ObjectImp::hasOwnProperty(ExecState *exec, unsigned propertyName) const287 {288 PropertySlot slot;289 return const_cast<ObjectImp *>(this)->getOwnPropertySlot(exec, propertyName, slot);290 }291 292 255 // ECMA 8.6.2.5 293 256 bool ObjectImp::deleteProperty(ExecState */*exec*/, const Identifier &propertyName) … … 312 275 { 313 276 return deleteProperty(exec, Identifier::from(propertyName)); 314 }315 316 void ObjectImp::deleteAllProperties( ExecState * )317 {318 _prop.clear();319 277 } 320 278 … … 372 330 return exec->exception(); 373 331 374 ObjectImp *err = Error::create(exec, TypeError, I18N_NOOP("No default value")); 375 exec->setException(err); 376 return err; 332 return throwError(exec, TypeError, "No default value"); 377 333 } 378 334 … … 506 462 const char * const * const Error::errorNames = errorNamesArr; 507 463 508 ObjectImp *Error::create(ExecState *exec, ErrorType errtype, const char *message,509 int lineno, int sourceId, const UString *sourceURL)464 ObjectImp *Error::create(ExecState *exec, ErrorType errtype, const UString &message, 465 int lineno, int sourceId, const UString *sourceURL) 510 466 { 511 467 ObjectImp *cons; … … 534 490 } 535 491 536 if (!message)537 message = errorNames[errtype];538 492 List args; 539 args.append(String(message)); 493 if (message.isEmpty()) 494 args.append(jsString(errorNames[errtype])); 495 else 496 args.append(jsString(message)); 540 497 ObjectImp *err = static_cast<ObjectImp *>(cons->construct(exec,args)); 541 498 … … 563 520 } 564 521 565 ObjectImp *error(ExecState *exec, ErrorType type, const char *message, int line, int sourceId, const UString *sourceURL) 566 { 567 return Error::create(exec, type, message, line, sourceId, sourceURL); 522 ObjectImp *Error::create(ExecState *exec, ErrorType type, const char *message) 523 { 524 return create(exec, type, message, -1, -1, NULL); 525 } 526 527 ObjectImp *throwError(ExecState *exec, ErrorType type) 528 { 529 ObjectImp *error = Error::create(exec, type, UString(), -1, -1, NULL); 530 exec->setException(error); 531 return error; 532 } 533 534 ObjectImp *throwError(ExecState *exec, ErrorType type, const UString &message) 535 { 536 ObjectImp *error = Error::create(exec, type, message, -1, -1, NULL); 537 exec->setException(error); 538 return error; 539 } 540 541 ObjectImp *throwError(ExecState *exec, ErrorType type, const char *message) 542 { 543 ObjectImp *error = Error::create(exec, type, message, -1, -1, NULL); 544 exec->setException(error); 545 return error; 546 } 547 548 ObjectImp *throwError(ExecState *exec, ErrorType type, const UString &message, int line, int sourceId, const UString *sourceURL) 549 { 550 ObjectImp *error = Error::create(exec, type, message, line, sourceId, sourceURL); 551 exec->setException(error); 552 return error; 568 553 } 569 554
Note:
See TracChangeset
for help on using the changeset viewer.