Changeset 12489 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Jan 30, 2006, 11:41:01 PM (19 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/nodes.cpp
r12317 r12489 849 849 return jsString("string"); 850 850 default: 851 if (v->isObject() && static_cast<JSObject*>(v)->implementsCall()) 852 return jsString("function"); 853 else 854 return jsString("object"); 851 if (v->isObject()) { 852 // Return "undefined" for objects that should be treated 853 // as null when doing comparisons. 854 if (static_cast<JSObject*>(v)->masqueradeAsUndefined()) 855 return jsString("undefined"); 856 else if (static_cast<JSObject*>(v)->implementsCall()) 857 return jsString("function"); 858 } 859 860 return jsString("object"); 855 861 } 856 862 } -
trunk/JavaScriptCore/kjs/object.h
r12317 r12489 495 495 bool getPropertyAttributes(const Identifier& propertyName, int& attributes) const; 496 496 497 // Returns whether the object should be treated as nullwhen doing equality comparisons498 virtual bool isEqualToNull(ExecState *) const { return false; }497 // Returns whether the object should be treated as undefined when doing equality comparisons 498 virtual bool masqueradeAsUndefined() const { return false; } 499 499 500 500 // This get function only looks at the property map. -
trunk/JavaScriptCore/kjs/operations.cpp
r12317 r12489 131 131 return equal(exec, v1, v2->toPrimitive(exec)); 132 132 if (t1 == NullType && t2 == ObjectType) 133 return static_cast<JSObject *>(v2)-> isEqualToNull(exec);133 return static_cast<JSObject *>(v2)->masqueradeAsUndefined(); 134 134 if (t1 >= ObjectType && (t2 == StringType || t2 == NumberType)) 135 135 return equal(exec, v1->toPrimitive(exec), v2); 136 136 if (t1 == ObjectType && t2 == NullType) 137 return static_cast<JSObject *>(v1)-> isEqualToNull(exec);137 return static_cast<JSObject *>(v1)->masqueradeAsUndefined(); 138 138 if (t1 != t2) 139 139 return false;
Note:
See TracChangeset
for help on using the changeset viewer.