make '..' work better with mixed integer types for backwards compat
This commit is contained in:
parent
c59ab1d9c6
commit
e96189c9c3
1 changed files with 12 additions and 12 deletions
|
|
@ -2025,19 +2025,19 @@ when defined(nimNewRoof):
|
||||||
yield res
|
yield res
|
||||||
inc(res)
|
inc(res)
|
||||||
|
|
||||||
iterator `..`*(a, b: int64): int64 {.inline.} =
|
template dotdotImpl(t) {.dirty.} =
|
||||||
## A special version of ``..`` for ``int64`` only.
|
iterator `..`*(a, b: t): t {.inline.} =
|
||||||
var res = a
|
## A type specialized version of ``..`` for convenience so that
|
||||||
while res <= b:
|
## mixing integer types work better.
|
||||||
yield res
|
var res = a
|
||||||
inc(res)
|
while res <= b:
|
||||||
|
yield res
|
||||||
|
inc(res)
|
||||||
|
|
||||||
iterator `..`*(a, b: int32): int32 {.inline.} =
|
dotdotImpl(int64)
|
||||||
## A special version of ``..`` for ``int32`` only.
|
dotdotImpl(int32)
|
||||||
var res = a
|
dotdotImpl(uint64)
|
||||||
while res <= b:
|
dotdotImpl(uint32)
|
||||||
yield res
|
|
||||||
inc(res)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
iterator countup*[S, T](a: S, b: T, step = 1): T {.inline.} =
|
iterator countup*[S, T](a: S, b: T, step = 1): T {.inline.} =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue