Changeset 96045 in webkit for trunk/Source/JavaScriptCore/runtime/JSString.h
- Timestamp:
- Sep 26, 2011, 4:53:42 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSString.h
r95516 r96045 428 428 429 429 JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const; 430 bool toBoolean(ExecState*) const; 431 430 432 bool getStringPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); 431 433 bool getStringPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); … … 495 497 496 498 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value); 497 virtual bool toBoolean(ExecState*) const;498 499 virtual double toNumber(ExecState*) const; 499 500 virtual JSObject* toObject(ExecState*, JSGlobalObject*) const; … … 681 682 inline bool isJSString(JSGlobalData* globalData, JSValue v) { return v.isCell() && v.asCell()->vptr() == globalData->jsStringVPtr; } 682 683 684 inline bool JSCell::toBoolean(ExecState* exec) const 685 { 686 if (isString()) 687 return static_cast<const JSString*>(this)->toBoolean(exec); 688 return !structure()->typeInfo().masqueradesAsUndefined(); 689 } 690 683 691 // --- JSValue inlines ---------------------------- 692 693 inline bool JSValue::toBoolean(ExecState* exec) const 694 { 695 if (isInt32()) 696 return asInt32(); 697 if (isDouble()) 698 return asDouble() > 0.0 || asDouble() < 0.0; // false for NaN 699 if (isCell()) 700 return asCell()->toBoolean(exec); 701 return isTrue(); // false, null, and undefined all convert to false. 702 } 684 703 685 704 inline UString JSValue::toString(ExecState* exec) const
Note:
See TracChangeset
for help on using the changeset viewer.