Ignore:
Timestamp:
Oct 6, 2002, 3:17:41 PM (23 years ago)
Author:
darin
Message:

I noticed some broken lists at mapblast.com and tracked it down to this.

  • kjs/array_object.cpp: (ArrayInstanceImp::put): Don't truncate the list; only extend the length if it's not already long enough. (ArrayProtoFuncImp::call): Fix some ifdef'd code so it compiles if you turn the ifdefs on.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/array_object.cpp

    r1823 r2262  
    102102  unsigned index = propertyName.toULong(&ok);
    103103  if (ok) {
    104     setLength(index + 1);
     104    if (length <= index)
     105      setLength(index + 1);
    105106    storage[index] = value.imp();
    106107    return;
     
    112113void ArrayInstanceImp::put(ExecState *exec, unsigned index, const Value &value, int attr)
    113114{
    114   setLength(index + 1);
     115  if (length <= index)
     116    setLength(index + 1);
    115117  storage[index] = value.imp();
    116118}
     
    412414    printf("KJS Array::Sort length=%d\n", length);
    413415    for ( unsigned int i = 0 ; i<length ; ++i )
    414       printf("KJS Array::Sort: %d: %s\n", i, thisObj.get(i).toString().value().ascii() );
     416      printf("KJS Array::Sort: %d: %s\n", i, thisObj.get(exec, i).toString(exec).ascii() );
    415417#endif
    416418    Object sortFunction;
     
    470472    printf("KJS Array::Sort -- Resulting array:\n");
    471473    for ( unsigned int i = 0 ; i<length ; ++i )
    472       printf("KJS Array::Sort: %d: %s\n", i, thisObj.get(i).toString().value().ascii() );
     474      printf("KJS Array::Sort: %d: %s\n", i, thisObj.get(exec, i).toString(exec).ascii() );
    473475#endif
    474476    result = thisObj;
Note: See TracChangeset for help on using the changeset viewer.