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)
|
result.add(elem)
|
||||||
|
|
||||||
template itemsListImpl() {.dirty.} =
|
template itemsListImpl() {.dirty.} =
|
||||||
var it = L.head
|
var it {.cursor.} = L.head
|
||||||
while it != nil:
|
while it != nil:
|
||||||
yield it.value
|
yield it.value
|
||||||
it = it.next
|
it = it.next
|
||||||
|
|
||||||
template itemsRingImpl() {.dirty.} =
|
template itemsRingImpl() {.dirty.} =
|
||||||
var it = L.head
|
var it {.cursor.} = L.head
|
||||||
if it != nil:
|
if it != nil:
|
||||||
while true:
|
while true:
|
||||||
yield it.value
|
yield it.value
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue