Replace countup(x, y-1) with x ..< y
This commit is contained in:
parent
9ffab44c35
commit
f18b3af9d4
58 changed files with 312 additions and 312 deletions
|
|
@ -1357,7 +1357,7 @@ proc assignType*(dest, src: PType) =
|
|||
else:
|
||||
dest.sym = src.sym
|
||||
newSons(dest, sonsLen(src))
|
||||
for i in countup(0, sonsLen(src) - 1): dest.sons[i] = src.sons[i]
|
||||
for i in 0 ..< sonsLen(src): dest.sons[i] = src.sons[i]
|
||||
|
||||
proc copyType*(t: PType, owner: PSym, keepId: bool): PType =
|
||||
result = newType(t.kind, owner)
|
||||
|
|
@ -1582,17 +1582,17 @@ proc copyTree*(src: PNode): PNode =
|
|||
of nkStrLit..nkTripleStrLit: result.strVal = src.strVal
|
||||
else:
|
||||
newSeq(result.sons, sonsLen(src))
|
||||
for i in countup(0, sonsLen(src) - 1):
|
||||
for i in 0 ..< sonsLen(src):
|
||||
result.sons[i] = copyTree(src.sons[i])
|
||||
|
||||
proc hasSonWith*(n: PNode, kind: TNodeKind): bool =
|
||||
for i in countup(0, sonsLen(n) - 1):
|
||||
for i in 0 ..< sonsLen(n):
|
||||
if n.sons[i].kind == kind:
|
||||
return true
|
||||
result = false
|
||||
|
||||
proc hasNilSon*(n: PNode): bool =
|
||||
for i in countup(0, safeLen(n) - 1):
|
||||
for i in 0 ..< safeLen(n):
|
||||
if n.sons[i] == nil:
|
||||
return true
|
||||
elif hasNilSon(n.sons[i]):
|
||||
|
|
@ -1604,14 +1604,14 @@ proc containsNode*(n: PNode, kinds: TNodeKinds): bool =
|
|||
case n.kind
|
||||
of nkEmpty..nkNilLit: result = n.kind in kinds
|
||||
else:
|
||||
for i in countup(0, sonsLen(n) - 1):
|
||||
for i in 0 ..< sonsLen(n):
|
||||
if n.kind in kinds or containsNode(n.sons[i], kinds): return true
|
||||
|
||||
proc hasSubnodeWith*(n: PNode, kind: TNodeKind): bool =
|
||||
case n.kind
|
||||
of nkEmpty..nkNilLit: result = n.kind == kind
|
||||
else:
|
||||
for i in countup(0, sonsLen(n) - 1):
|
||||
for i in 0 ..< sonsLen(n):
|
||||
if (n.sons[i].kind == kind) or hasSubnodeWith(n.sons[i], kind):
|
||||
return true
|
||||
result = false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue