(id int)
| 674 | } |
| 675 | |
| 676 | func (t *TypeCache) LookupType(id int) (Type, error) { |
| 677 | if id < len(t.cache) { |
| 678 | if typ := t.cache[id]; typ != nil { |
| 679 | return typ, nil |
| 680 | } |
| 681 | } |
| 682 | typ, err := t.fetcher.LookupType(id) |
| 683 | if err != nil { |
| 684 | return nil, err |
| 685 | } |
| 686 | if id >= len(t.cache) { |
| 687 | t.cache = slices.Grow(t.cache[:0], id+1)[:id+1] |
| 688 | } |
| 689 | t.cache[id] = typ |
| 690 | return typ, nil |
| 691 | } |
nothing calls this directly
no test coverage detected