(ctx *objectExportCtx)
| 430 | } |
| 431 | |
| 432 | func (a *sparseArrayObject) export(ctx *objectExportCtx) interface{} { |
| 433 | if v, exists := ctx.get(a.val); exists { |
| 434 | return v |
| 435 | } |
| 436 | arr := make([]interface{}, a.length) |
| 437 | ctx.put(a.val, arr) |
| 438 | var prevIdx uint32 |
| 439 | for _, item := range a.items { |
| 440 | idx := item.idx |
| 441 | for i := prevIdx; i < idx; i++ { |
| 442 | if a.prototype != nil { |
| 443 | if v := a.prototype.self.getIdx(valueInt(i), nil); v != nil { |
| 444 | arr[i] = exportValue(v, ctx) |
| 445 | } |
| 446 | } |
| 447 | } |
| 448 | v := item.value |
| 449 | if v != nil { |
| 450 | if prop, ok := v.(*valueProperty); ok { |
| 451 | v = prop.get(a.val) |
| 452 | } |
| 453 | arr[idx] = exportValue(v, ctx) |
| 454 | } |
| 455 | prevIdx = idx + 1 |
| 456 | } |
| 457 | for i := prevIdx; i < a.length; i++ { |
| 458 | if a.prototype != nil { |
| 459 | if v := a.prototype.self.getIdx(valueInt(i), nil); v != nil { |
| 460 | arr[i] = exportValue(v, ctx) |
| 461 | } |
| 462 | } |
| 463 | } |
| 464 | return arr |
| 465 | } |
| 466 | |
| 467 | func (a *sparseArrayObject) exportType() reflect.Type { |
| 468 | return reflectTypeArray |
nothing calls this directly
no test coverage detected