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

@ -407,7 +407,7 @@ proc genProcParams(m: BModule, t: PType, rettype, params: var Rope,
rettype = ~"void"
else:
rettype = getTypeDescAux(m, t.sons[0], check)
for i in countup(1, sonsLen(t.n) - 1):
for i in 1 ..< sonsLen(t.n):
if t.n.sons[i].kind != nkSym: internalError(m.config, t.n.info, "genProcParams")
var param = t.n.sons[i].sym
if isCompileTimeOnly(param.typ): continue
@ -468,7 +468,7 @@ proc genRecordFieldsAux(m: BModule, n: PNode,
result = nil
case n.kind
of nkRecList:
for i in countup(0, sonsLen(n) - 1):
for i in 0 ..< sonsLen(n):
add(result, genRecordFieldsAux(m, n.sons[i], rectype, check))
of nkRecCase:
if n.sons[0].kind != nkSym: internalError(m.config, n.info, "genRecordFieldsAux")
@ -476,7 +476,7 @@ proc genRecordFieldsAux(m: BModule, n: PNode,
# prefix mangled name with "_U" to avoid clashes with other field names,
# since identifiers are not allowed to start with '_'
var unionBody: Rope = nil
for i in countup(1, sonsLen(n) - 1):
for i in 1 ..< sonsLen(n):
case n.sons[i].kind
of nkOfBranch, nkElse:
let k = lastSon(n.sons[i])
@ -591,7 +591,7 @@ proc getTupleDesc(m: BModule, typ: PType, name: Rope,
check: var IntSet): Rope =
result = "$1 $2 {$n" % [structOrUnion(typ), name]
var desc: Rope = nil
for i in countup(0, sonsLen(typ) - 1):
for i in 0 ..< sonsLen(typ):
addf(desc, "$1 Field$2;$n",
[getTypeDescAux(m, typ.sons[i], check), rope(i)])
if desc == nil: add(result, "char dummy;\L")
@ -710,7 +710,7 @@ proc getTypeDescAux(m: BModule, origTyp: PType, check: var IntSet): Rope =
let owner = hashOwner(t.sym)
if not gDebugInfo.hasEnum(t.sym.name.s, t.sym.info.line, owner):
var vals: seq[(string, int)] = @[]
for i in countup(0, t.n.len - 1):
for i in 0 ..< t.n.len:
assert(t.n.sons[i].kind == nkSym)
let field = t.n.sons[i].sym
vals.add((field.name.s, field.position.int))
@ -1047,7 +1047,7 @@ proc genObjectFields(m: BModule, typ, origType: PType, n: PNode, expr: Rope;
elif L > 0:
var tmp = getTempName(m) & "_" & $L
genTNimNodeArray(m, tmp, rope(L))
for i in countup(0, L-1):
for i in 0 ..< L:
var tmp2 = getNimNode(m)
addf(m.s[cfsTypeInit3], "$1[$2] = &$3;$n", [tmp, rope(i), tmp2])
genObjectFields(m, typ, origType, n.sons[i], tmp2, info)
@ -1072,7 +1072,7 @@ proc genObjectFields(m: BModule, typ, origType: PType, n: PNode, expr: Rope;
makeCString(field.name.s),
tmp, rope(L)])
addf(m.s[cfsData], "TNimNode* $1[$2];$n", [tmp, rope(L+1)])
for i in countup(1, sonsLen(n)-1):
for i in 1 ..< sonsLen(n):
var b = n.sons[i] # branch
var tmp2 = getNimNode(m)
genObjectFields(m, typ, origType, lastSon(b), tmp2, info)
@ -1133,7 +1133,7 @@ proc genTupleInfo(m: BModule, typ, origType: PType, name: Rope; info: TLineInfo)
if length > 0:
var tmp = getTempName(m) & "_" & $length
genTNimNodeArray(m, tmp, rope(length))
for i in countup(0, length - 1):
for i in 0 ..< length:
var a = typ.sons[i]
var tmp2 = getNimNode(m)
addf(m.s[cfsTypeInit3], "$1[$2] = &$3;$n", [tmp, rope(i), tmp2])
@ -1161,7 +1161,7 @@ proc genEnumInfo(m: BModule, typ: PType, name: Rope; info: TLineInfo) =
var enumNames, specialCases: Rope
var firstNimNode = m.typeNodes
var hasHoles = false
for i in countup(0, length - 1):
for i in 0 ..< length:
assert(typ.n.sons[i].kind == nkSym)
var field = typ.n.sons[i].sym
var elemNode = getNimNode(m)