(idx uint32)
| 315 | } |
| 316 | |
| 317 | func (a *sparseArrayObject) expand(idx uint32) bool { |
| 318 | if l := len(a.items); l >= 1024 { |
| 319 | if ii := a.items[l-1].idx; ii > idx { |
| 320 | idx = ii |
| 321 | } |
| 322 | if (bits.UintSize == 64 || idx < math.MaxInt32) && int(idx)>>3 < l { |
| 323 | //log.Println("Switching sparse->standard") |
| 324 | ar := &arrayObject{ |
| 325 | baseObject: a.baseObject, |
| 326 | length: a.length, |
| 327 | propValueCount: a.propValueCount, |
| 328 | } |
| 329 | ar.setValuesFromSparse(a.items, int(idx)) |
| 330 | ar.val.self = ar |
| 331 | ar.lengthProp.writable = a.lengthProp.writable |
| 332 | a._put("length", &ar.lengthProp) |
| 333 | return false |
| 334 | } |
| 335 | } |
| 336 | return true |
| 337 | } |
| 338 | |
| 339 | func (a *sparseArrayObject) _defineIdxProperty(idx uint32, desc PropertyDescriptor, throw bool) bool { |
| 340 | var existing Value |
no test coverage detected