diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2013-12-04 07:52:22 -0800 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2013-12-04 07:52:22 -0800 |
commit | 2264875237cb72cf0288f2bd3d4a930c2a1acc50 (patch) | |
tree | f586acadc3efe138e64c581380320214298af764 /compiler/lists.nim | |
parent | 32d2327be025f62bd1b51a98322879cc7e8d218f (diff) | |
parent | 5ab3d661440f42f0dc74970ec73a051dd2e2bfb5 (diff) | |
download | Nim-2264875237cb72cf0288f2bd3d4a930c2a1acc50.tar.gz |
Merge pull request #698 from fowlmouth/smallstdlib
removed x11
Diffstat (limited to 'compiler/lists.nim')
-rw-r--r-- | compiler/lists.nim | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/compiler/lists.nim b/compiler/lists.nim index 67b32f919..22b1a183a 100644 --- a/compiler/lists.nim +++ b/compiler/lists.nim @@ -91,13 +91,17 @@ proc Remove*(list: var TLinkedList, entry: PListEntry) = if entry.prev != nil: entry.prev.next = entry.next proc bringToFront*(list: var TLinkedList, entry: PListEntry) = - if entry == list.head: return - if entry == list.tail: list.tail = entry.prev - if entry.next != nil: entry.next.prev = entry.prev - if entry.prev != nil: entry.prev.next = entry.next - entry.prev = nil - entry.next = list.head - list.head = entry + when true: + list.remove entry + list.prepend entry + else: + if entry == list.head: return + if entry == list.tail: list.tail = entry.prev + if entry.next != nil: entry.next.prev = entry.prev + if entry.prev != nil: entry.prev.next = entry.next + entry.prev = nil + entry.next = list.head + list.head = entry proc ExcludeStr*(list: var TLinkedList, data: string) = var it = list.head |