diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-05-08 17:18:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-08 17:18:46 +0200 |
commit | 61380d0a070a4a691e820e18b25e9dd8fb420306 (patch) | |
tree | a786b6ba0f9e831fecfb75de2a5c3d097a24a962 /compiler/ast.nim | |
parent | 8180d443b9938f135dd280bcd5e1727766cd7468 (diff) | |
parent | cc28eef38e601171644ffe1a2775744eaaca8123 (diff) | |
download | Nim-61380d0a070a4a691e820e18b25e9dd8fb420306.tar.gz |
Small cleanup (#11185)
* Remove mStaticTy and mTypeTy * Replace countup(x, y-1) with x ..< y * Replace countup(x, y) with x .. y
Diffstat (limited to 'compiler/ast.nim')
-rw-r--r-- | compiler/ast.nim | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index 4ac1a1465..ee90c566b 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -1158,17 +1158,17 @@ const # for all kind of hash tables: proc copyStrTable*(dest: var TStrTable, src: TStrTable) = dest.counter = src.counter setLen(dest.data, len(src.data)) - for i in countup(0, high(src.data)): dest.data[i] = src.data[i] + for i in 0 .. high(src.data): dest.data[i] = src.data[i] proc copyIdTable*(dest: var TIdTable, src: TIdTable) = dest.counter = src.counter newSeq(dest.data, len(src.data)) - for i in countup(0, high(src.data)): dest.data[i] = src.data[i] + for i in 0 .. high(src.data): dest.data[i] = src.data[i] proc copyObjectSet*(dest: var TObjectSet, src: TObjectSet) = dest.counter = src.counter setLen(dest.data, len(src.data)) - for i in countup(0, high(src.data)): dest.data[i] = src.data[i] + for i in 0 .. high(src.data): dest.data[i] = src.data[i] proc discardSons*(father: PNode) = when defined(nimNoNilSeqs): @@ -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) @@ -1520,7 +1520,7 @@ proc delSon*(father: PNode, idx: int) = else: if isNil(father.sons): return var length = sonsLen(father) - for i in countup(idx, length - 2): father.sons[i] = father.sons[i + 1] + for i in idx .. length - 2: father.sons[i] = father.sons[i + 1] setLen(father.sons, length - 1) proc copyNode*(src: PNode): PNode = @@ -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 |