diff options
author | Clyybber <darkmine956@gmail.com> | 2019-05-07 12:04:00 +0200 |
---|---|---|
committer | Clyybber <darkmine956@gmail.com> | 2019-05-07 12:32:05 +0200 |
commit | f18b3af9d4a6393ba988cdb17d8f0861b1c75c7d (patch) | |
tree | 8d4fe109101792fb0f7bdfb33c0a0071d34e6f71 /compiler/ast.nim | |
parent | 9ffab44c35cb31c1811800e130e4dc1bd59503f9 (diff) | |
download | Nim-f18b3af9d4a6393ba988cdb17d8f0861b1c75c7d.tar.gz |
Replace countup(x, y-1) with x ..< y
Diffstat (limited to 'compiler/ast.nim')
-rw-r--r-- | compiler/ast.nim | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index 4ac1a1465..6382ab522 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -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 |