(entry: Entry<T>)
| 114 | } |
| 115 | |
| 116 | function access(entry: Entry<T>): T { |
| 117 | const next = entry.next; |
| 118 | if (next !== null) { |
| 119 | // Entry already cached |
| 120 | const resolvedFirst: Entry<T> = (first: any); |
| 121 | if (first !== entry) { |
| 122 | // Remove from current position |
| 123 | const previous = entry.previous; |
| 124 | previous.next = next; |
| 125 | next.previous = previous; |
| 126 | |
| 127 | // Append to head |
| 128 | const last = resolvedFirst.previous; |
| 129 | last.next = entry; |
| 130 | entry.previous = last; |
| 131 | |
| 132 | resolvedFirst.previous = entry; |
| 133 | entry.next = resolvedFirst; |
| 134 | |
| 135 | first = entry; |
| 136 | } |
| 137 | } else { |
| 138 | // Cannot access a deleted entry |
| 139 | // TODO: Error? Warning? |
| 140 | } |
| 141 | scheduleCleanUp(); |
| 142 | return entry.value; |
| 143 | } |
| 144 | |
| 145 | function setLimit(newLimit: number): void { |
| 146 | LIMIT = newLimit; |
nothing calls this directly
no test coverage detected