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/astalgo.nim | |
parent | 9ffab44c35cb31c1811800e130e4dc1bd59503f9 (diff) | |
download | Nim-f18b3af9d4a6393ba988cdb17d8f0861b1c75c7d.tar.gz |
Replace countup(x, y-1) with x ..< y
Diffstat (limited to 'compiler/astalgo.nim')
-rw-r--r-- | compiler/astalgo.nim | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/astalgo.nim b/compiler/astalgo.nim index 4c16e8501..bd997b962 100644 --- a/compiler/astalgo.nim +++ b/compiler/astalgo.nim @@ -152,14 +152,14 @@ proc lookupInRecord(n: PNode, field: PIdent): PSym = result = nil case n.kind of nkRecList: - for i in countup(0, sonsLen(n) - 1): + for i in 0 ..< sonsLen(n): result = lookupInRecord(n.sons[i], field) if result != nil: return of nkRecCase: if (n.sons[0].kind != nkSym): return nil result = lookupInRecord(n.sons[0], field) if result != nil: return - for i in countup(1, sonsLen(n) - 1): + for i in 1 ..< sonsLen(n): case n.sons[i].kind of nkOfBranch, nkElse: result = lookupInRecord(lastSon(n.sons[i]), field) @@ -175,7 +175,7 @@ proc getModule*(s: PSym): PSym = while result != nil and result.kind != skModule: result = result.owner proc getSymFromList(list: PNode, ident: PIdent, start: int = 0): PSym = - for i in countup(start, sonsLen(list) - 1): + for i in start ..< sonsLen(list): if list.sons[i].kind == nkSym: result = list.sons[i].sym if result.name.id == ident.id: return @@ -281,7 +281,7 @@ proc typeToYamlAux(conf: ConfigRef; n: PType, marker: var IntSet, indent: int, else: if sonsLen(n) > 0: sonsRope = rope("[") - for i in countup(0, sonsLen(n) - 1): + for i in 0 ..< sonsLen(n): if i > 0: add(sonsRope, ",") addf(sonsRope, "$N$1$2", [rspaces(indent + 4), typeToYamlAux(conf, n.sons[i], marker, indent + 4, maxRecDepth - 1)]) @@ -330,7 +330,7 @@ proc treeToYamlAux(conf: ConfigRef; n: PNode, marker: var IntSet, indent: int, else: if sonsLen(n) > 0: addf(result, ",$N$1\"sons\": [", [istr]) - for i in countup(0, sonsLen(n) - 1): + for i in 0 ..< sonsLen(n): if i > 0: add(result, ",") addf(result, "$N$1$2", [rspaces(indent + 4), treeToYamlAux(conf, n.sons[i], marker, indent + 4, maxRecDepth - 1)]) @@ -960,7 +960,7 @@ iterator pairs*(t: TIdNodeTable): tuple[key: PIdObj, val: PNode] = proc initIITable(x: var TIITable) = x.counter = 0 newSeq(x.data, StartSize) - for i in countup(0, StartSize - 1): x.data[i].key = InvalidKey + for i in 0 ..< StartSize: x.data[i].key = InvalidKey proc iiTableRawGet(t: TIITable, key: int): int = var h: Hash @@ -1008,4 +1008,4 @@ proc isAddrNode*(n: PNode): bool = of nkCallKinds: if n[0].kind == nkSym and n[0].sym.magic == mAddr: true else: false - else: false \ No newline at end of file + else: false |