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/docgen.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/docgen.nim')
-rw-r--r-- | compiler/docgen.nim | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/compiler/docgen.nim b/compiler/docgen.nim index bad57fa18..2e9b1affe 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -177,7 +177,7 @@ template dispA(conf: ConfigRef; dest: var Rope, xml, tex: string, args: openArra else: addf(dest, tex, args) proc getVarIdx(varnames: openArray[string], id: string): int = - for i in countup(0, high(varnames)): + for i in 0 .. high(varnames): if cmpIgnoreStyle(varnames[i], id) == 0: return i result = -1 @@ -256,7 +256,7 @@ proc genRecCommentAux(d: PDoc, n: PNode): Rope = if n.kind in {nkStmtList, nkStmtListExpr, nkTypeDef, nkConstDef, nkObjectTy, nkRefTy, nkPtrTy, nkAsgn, nkFastAsgn, nkHiddenStdConv}: # notin {nkEmpty..nkNilLit, nkEnumTy, nkTupleTy}: - for i in countup(0, len(n)-1): + for i in 0 ..< len(n): result = genRecCommentAux(d, n.sons[i]) if result != nil: return else: @@ -284,7 +284,7 @@ proc getPlainDocstring(n: PNode): string = if startsWith(n.comment, "##"): result = n.comment if result.len < 1: - for i in countup(0, safeLen(n)-1): + for i in 0 ..< safeLen(n): result = getPlainDocstring(n.sons[i]) if result.len > 0: return @@ -838,13 +838,13 @@ proc generateDoc*(d: PDoc, n, orig: PNode) = when useEffectSystem: documentRaises(d.cache, n) genItem(d, n, n.sons[namePos], skConverter) of nkTypeSection, nkVarSection, nkLetSection, nkConstSection: - for i in countup(0, sonsLen(n) - 1): + for i in 0 ..< sonsLen(n): if n.sons[i].kind != nkCommentStmt: # order is always 'type var let const': genItem(d, n.sons[i], n.sons[i].sons[0], succ(skType, ord(n.kind)-ord(nkTypeSection))) of nkStmtList: - for i in countup(0, sonsLen(n) - 1): generateDoc(d, n.sons[i], orig) + for i in 0 ..< sonsLen(n): generateDoc(d, n.sons[i], orig) of nkWhenStmt: # generate documentation for the first branch only: if not checkForFalse(n.sons[0].sons[0]): @@ -892,13 +892,13 @@ proc generateJson*(d: PDoc, n: PNode, includeComments: bool = true) = when useEffectSystem: documentRaises(d.cache, n) d.add genJsonItem(d, n, n.sons[namePos], skConverter) of nkTypeSection, nkVarSection, nkLetSection, nkConstSection: - for i in countup(0, sonsLen(n) - 1): + for i in 0 ..< sonsLen(n): if n.sons[i].kind != nkCommentStmt: # order is always 'type var let const': d.add genJsonItem(d, n.sons[i], n.sons[i].sons[0], succ(skType, ord(n.kind)-ord(nkTypeSection))) of nkStmtList: - for i in countup(0, sonsLen(n) - 1): + for i in 0 ..< sonsLen(n): generateJson(d, n.sons[i], includeComments) of nkWhenStmt: # generate documentation for the first branch only: @@ -935,13 +935,13 @@ proc generateTags*(d: PDoc, n: PNode, r: var Rope) = when useEffectSystem: documentRaises(d.cache, n) r.add genTagsItem(d, n, n.sons[namePos], skConverter) of nkTypeSection, nkVarSection, nkLetSection, nkConstSection: - for i in countup(0, sonsLen(n) - 1): + for i in 0 ..< sonsLen(n): if n.sons[i].kind != nkCommentStmt: # order is always 'type var let const': r.add genTagsItem(d, n.sons[i], n.sons[i].sons[0], succ(skType, ord(n.kind)-ord(nkTypeSection))) of nkStmtList: - for i in countup(0, sonsLen(n) - 1): + for i in 0 ..< sonsLen(n): generateTags(d, n.sons[i], r) of nkWhenStmt: # generate documentation for the first branch only: @@ -971,12 +971,12 @@ proc genOutFile(d: PDoc): Rope = var tmp = "" renderTocEntries(d[], j, 1, tmp) var toc = tmp.rope - for i in countup(low(TSymKind), high(TSymKind)): + for i in low(TSymKind) .. high(TSymKind): genSection(d, i) add(toc, d.toc[i]) if toc != nil: toc = ropeFormatNamedVars(d.conf, getConfigVar(d.conf, "doc.toc"), ["content"], [toc]) - for i in countup(low(TSymKind), high(TSymKind)): add(code, d.section[i]) + for i in low(TSymKind) .. high(TSymKind): add(code, d.section[i]) # Extract the title. Non API modules generate an entry in the index table. if d.meta[metaTitle].len != 0: |