mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 12:07:51 +00:00
Add cursor annotations to lists iterator variables (#21507)
Add `cursor` annotations to iterator variables * See https://nim-lang.github.io/Nim/destructors.html#the-cursor-pragma
This commit is contained in:
committed by
GitHub
parent
b2c1dcbbc9
commit
c52e44d845
@@ -188,13 +188,13 @@ func toDoublyLinkedList*[T](elems: openArray[T]): DoublyLinkedList[T] {.since: (
|
||||
result.add(elem)
|
||||
|
||||
template itemsListImpl() {.dirty.} =
|
||||
var it = L.head
|
||||
var it {.cursor.} = L.head
|
||||
while it != nil:
|
||||
yield it.value
|
||||
it = it.next
|
||||
|
||||
template itemsRingImpl() {.dirty.} =
|
||||
var it = L.head
|
||||
var it {.cursor.} = L.head
|
||||
if it != nil:
|
||||
while true:
|
||||
yield it.value
|
||||
|
||||
Reference in New Issue
Block a user