fixes #25849; fixes #25872; Iteration on elements of array (#25860)

fixes #25849
fixes https://github.com/nim-lang/Nim/issues/25872
This commit is contained in:
ringabout
2026-06-06 13:58:19 +08:00
committed by GitHub
parent 46259cd0b8
commit f1ff8b6d9e
3 changed files with 53 additions and 5 deletions

View File

@@ -3,7 +3,7 @@
when defined(nimPreviewSlimSystem):
import std/assertions
when not defined(nimNoLentIterators):
when (not defined(nimNoLentIterators)) and not defined(js) and not defined(nimscript):
template lent2(T): untyped = lent T
else:
template lent2(T): untyped = T
@@ -37,7 +37,7 @@ iterator mitems*[T](a: var openArray[T]): var T {.inline.} =
yield a[i]
unCheckedInc(i)
iterator items*[IX, T](a: array[IX, T]): T {.inline.} =
iterator items*[IX, T](a: array[IX, T]): lent2 T {.inline.} =
## Iterates over each item of `a`.
when a.len > 0:
var i = low(IX)