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