Changeset 95229 in webkit for trunk/Source/JavaScriptCore/runtime/JSString.h
- Timestamp:
- Sep 15, 2011, 2:24:09 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSString.h
r95167 r95229 63 63 public: 64 64 friend class JIT; 65 friend class JSCell;66 65 friend class JSGlobalData; 67 friend class JSValue;68 66 friend class SpecializedThunkJIT; 69 67 friend struct ThunkHelpers; … … 497 495 virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const; 498 496 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value); 499 bool toBoolean(ExecState*) const;497 virtual bool toBoolean(ExecState*) const; 500 498 virtual double toNumber(ExecState*) const; 501 499 virtual JSObject* toObject(ExecState*, JSGlobalObject*) const; … … 683 681 inline bool isJSString(JSGlobalData* globalData, JSValue v) { return v.isCell() && v.asCell()->vptr() == globalData->jsStringVPtr; } 684 682 685 inline bool JSCell::toBoolean(ExecState* exec) const686 {687 if (isString())688 return static_cast<const JSString*>(this)->toBoolean(exec);689 return !structure()->typeInfo().masqueradesAsUndefined();690 }691 692 683 // --- JSValue inlines ---------------------------- 693 694 inline bool JSValue::toBoolean(ExecState* exec) const695 {696 if (isInt32())697 return asInt32();698 if (isDouble())699 return asDouble() > 0.0 || asDouble() < 0.0; // false for NaN700 if (isCell())701 return asCell()->toBoolean(exec);702 return isTrue(); // false, null, and undefined all convert to false.703 }704 684 705 685 inline UString JSValue::toString(ExecState* exec) const
Note:
See TracChangeset
for help on using the changeset viewer.