Changeset 6028 in webkit for trunk/JavaScriptCore/kjs/array_object.cpp
- Timestamp:
- Feb 2, 2004, 5:18:18 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/array_object.cpp
r6025 r6028 46 46 : ObjectImp(proto) 47 47 , length(initialLength) 48 , storageLength(initialLength )48 , storageLength(initialLength < sparseArrayCutoff ? initialLength : 0) 49 49 , capacity(storageLength) 50 50 , storage(capacity ? (ValueImp **)calloc(capacity, sizeof(ValueImp *)) : 0) … … 796 796 { 797 797 // a single numeric argument denotes the array size (!) 798 if (args.size() == 1 && args[0].type() == NumberType) 799 return Object(new ArrayInstanceImp(exec->interpreter()->builtinArrayPrototype().imp(), args[0].toUInt32(exec))); 798 if (args.size() == 1 && args[0].type() == NumberType) { 799 uint32_t n = args[0].toUInt32(exec); 800 if (n != args[0].toNumber(exec)) { 801 Object error = Error::create(exec, RangeError, "Array size is not a small enough positive integer."); 802 exec->setException(error); 803 return error; 804 } 805 return Object(new ArrayInstanceImp(exec->interpreter()->builtinArrayPrototype().imp(), n)); 806 } 800 807 801 808 // otherwise the array is constructed with the arguments in it
Note:
See TracChangeset
for help on using the changeset viewer.