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:
parent
b2c1dcbbc9
commit
c52e44d845
1 changed files with 2 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue