summary refs log tree commit diff stats
path: root/compiler/lists.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-12-05 00:03:27 +0100
committerAraq <rumpf_a@web.de>2013-12-05 00:03:27 +0100
commit5eba93d584d5446256d05f0eef111ace5e12bac3 (patch)
tree7b638031f3e77c16ca0c27b9c83630d78846f19e /compiler/lists.nim
parent9035d15ed22de1f80486d94ec63e720a4d04cbc0 (diff)
parent2264875237cb72cf0288f2bd3d4a930c2a1acc50 (diff)
downloadNim-5eba93d584d5446256d05f0eef111ace5e12bac3.tar.gz
Merge branch 'master' into vm2
Conflicts:
	compiler/sem.nim
Diffstat (limited to 'compiler/lists.nim')
-rw-r--r--compiler/lists.nim18
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