iterators: several small fixes (#11162)
* fix pairs, mpairs, mitems for cstring for JS backend * add mutation check for pairs and mpairs for strings and seqs * change the assertion message - modifying (changing elements) is not a problem, changing the length is
This commit is contained in:
parent
d2e1936cf2
commit
ce152ed91f
3 changed files with 53 additions and 26 deletions
|
|
@ -6,7 +6,7 @@ iterator myitems*[T](a: var seq[T]): var T {.inline.} =
|
|||
while i < L:
|
||||
yield a[i]
|
||||
inc(i)
|
||||
assert(len(a) == L, "seq modified while iterating over it")
|
||||
assert(len(a) == L, "the length of the seq changed while iterating over it")
|
||||
|
||||
# Works fine
|
||||
var xs = @[1,2,3]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue