Replace countup(x, y-1) with x ..< y

This commit is contained in:
Clyybber 2019-05-07 12:04:00 +02:00
commit f18b3af9d4
58 changed files with 312 additions and 312 deletions

View file

@ -366,7 +366,7 @@ proc genIf(c: PCtx, n: PNode; dest: var TDest) =
# Lend:
if dest < 0 and not isEmptyType(n.typ): dest = getTemp(c, n.typ)
var endings: seq[TPosition] = @[]
for i in countup(0, len(n) - 1):
for i in 0 ..< len(n):
var it = n.sons[i]
if it.len == 2:
withTemp(tmp, it.sons[0].typ):
@ -436,7 +436,7 @@ proc sameConstant*(a, b: PNode): bool =
of nkEmpty: result = true
else:
if sonsLen(a) == sonsLen(b):
for i in countup(0, sonsLen(a) - 1):
for i in 0 ..< sonsLen(a):
if not sameConstant(a.sons[i], b.sons[i]): return
result = true
@ -1739,10 +1739,10 @@ proc genArrAccess(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags) =
proc getNullValueAux(obj: PNode, result: PNode; conf: ConfigRef) =
case obj.kind
of nkRecList:
for i in countup(0, sonsLen(obj) - 1): getNullValueAux(obj.sons[i], result, conf)
for i in 0 ..< sonsLen(obj): getNullValueAux(obj.sons[i], result, conf)
of nkRecCase:
getNullValueAux(obj.sons[0], result, conf)
for i in countup(1, sonsLen(obj) - 1):
for i in 1 ..< sonsLen(obj):
getNullValueAux(lastSon(obj.sons[i]), result, conf)
of nkSym:
let field = newNodeI(nkExprColonExpr, result.info)
@ -1784,11 +1784,11 @@ proc getNullValue(typ: PType, info: TLineInfo; conf: ConfigRef): PNode =
getNullValueAux(t.n, result, conf)
of tyArray:
result = newNodeIT(nkBracket, info, t)
for i in countup(0, int(lengthOrd(conf, t)) - 1):
for i in 0 ..< int(lengthOrd(conf, t)):
addSon(result, getNullValue(elemType(t), info, conf))
of tyTuple:
result = newNodeIT(nkTupleConstr, info, t)
for i in countup(0, sonsLen(t) - 1):
for i in 0 ..< sonsLen(t):
addSon(result, getNullValue(t.sons[i], info, conf))
of tySet:
result = newNodeIT(nkCurly, info, t)