(l uint32, throw bool)
| 31 | } |
| 32 | |
| 33 | func (a *sparseArrayObject) _setLengthInt(l uint32, throw bool) bool { |
| 34 | ret := true |
| 35 | if l <= a.length { |
| 36 | if a.propValueCount > 0 { |
| 37 | // Slow path |
| 38 | for i := len(a.items) - 1; i >= 0; i-- { |
| 39 | item := a.items[i] |
| 40 | if item.idx <= l { |
| 41 | break |
| 42 | } |
| 43 | if prop, ok := item.value.(*valueProperty); ok { |
| 44 | if !prop.configurable { |
| 45 | l = item.idx + 1 |
| 46 | ret = false |
| 47 | break |
| 48 | } |
| 49 | a.propValueCount-- |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | idx := a.findIdx(l) |
| 56 | |
| 57 | aa := a.items[idx:] |
| 58 | for i := range aa { |
| 59 | aa[i].value = nil |
| 60 | } |
| 61 | a.items = a.items[:idx] |
| 62 | a.length = l |
| 63 | if !ret { |
| 64 | a.val.runtime.typeErrorResult(throw, "Cannot redefine property: length") |
| 65 | } |
| 66 | return ret |
| 67 | } |
| 68 | |
| 69 | func (a *sparseArrayObject) setLengthInt(l uint32, throw bool) bool { |
| 70 | if l == a.length { |
no test coverage detected