diff options
author | Martin Odersky <odersky@gmail.com> | 2013-12-25 19:08:52 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-12-25 19:08:52 +0100 |
commit | d85b6a22a654458e4f3b9754f77dc621b0fdbe66 (patch) | |
tree | ca85fa95b04d7360136f9f8f5a6f861fa1b569ed /src/dotty/tools/dotc/util/LRUCache.scala | |
parent | f24295a7448fc67b399f292f05d89e4b216d9749 (diff) | |
download | dotty-d85b6a22a654458e4f3b9754f77dc621b0fdbe66.tar.gz dotty-d85b6a22a654458e4f3b9754f77dc621b0fdbe66.tar.bz2 dotty-d85b6a22a654458e4f3b9754f77dc621b0fdbe66.zip |
Small tweak to LRU-cache.
Diffstat (limited to 'src/dotty/tools/dotc/util/LRUCache.scala')
-rw-r--r-- | src/dotty/tools/dotc/util/LRUCache.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/util/LRUCache.scala b/src/dotty/tools/dotc/util/LRUCache.scala index 35dc97527..5a485081f 100644 --- a/src/dotty/tools/dotc/util/LRUCache.scala +++ b/src/dotty/tools/dotc/util/LRUCache.scala @@ -32,8 +32,9 @@ class LRUCache[Key >: Null : ClassTag, Value >: Null: ClassTag] { def lookupNext(prev: Int, current: Int, nx: SixteenNibbles): Value = { val follow = nx(current) if (keys(current) == key) { + // arrange so that found element is at position `first`. if (current == last) last = prev - else { + else if (prev != last) { next = next.updated(prev, follow) next = next.updated(current, first) next = next.updated(last, current) |