Changeset 15952 in webkit for trunk/JavaScriptCore/kjs/array_object.cpp
- Timestamp:
- Aug 21, 2006, 10:43:55 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/array_object.cpp
r15846 r15952 404 404 some ArrayProtoFunc::Some DontEnum|Function 1 405 405 indexOf ArrayProtoFunc::IndexOf DontEnum|Function 1 406 lastIndexOf ArrayProtoFunc::LastIndexOf DontEnum|Function 1 406 407 filter ArrayProtoFunc::Filter DontEnum|Function 1 407 408 map ArrayProtoFunc::Map DontEnum|Function 1 … … 893 894 return jsNumber(-1); 894 895 } 895 896 case LastIndexOf: { 897 // JavaScript 1.6 Extension by Mozilla 898 // Documentation: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:lastIndexOf 899 900 int index = length - 1; 901 double d = args[1]->toInteger(exec); 902 903 if (d < 0) { 904 d += length; 905 if (d < 0) 906 return jsNumber(-1); 907 } 908 if (d < length) 909 index = static_cast<int>(d); 910 911 JSValue* searchElement = args[0]; 912 for (; index >= 0; --index) { 913 JSValue* e = getProperty(exec, thisObj, index); 914 if (!e) 915 e = jsUndefined(); 916 if (strictEqual(exec, searchElement, e)) 917 return jsNumber(index); 918 } 919 920 return jsNumber(-1); 921 } 896 922 default: 897 923 assert(0);
Note:
See TracChangeset
for help on using the changeset viewer.