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
|
|
@ -153,7 +153,7 @@ proc semIf(c: PContext, n: PNode; flags: TExprFlags): PNode =
|
|||
result = n
|
||||
var typ = commonTypeBegin
|
||||
var hasElse = false
|
||||
for i in countup(0, sonsLen(n) - 1):
|
||||
for i in 0 ..< sonsLen(n):
|
||||
var it = n.sons[i]
|
||||
if it.len == 2:
|
||||
openScope(c)
|
||||
|
|
@ -356,7 +356,7 @@ proc isDiscardUnderscore(v: PSym): bool =
|
|||
proc semUsing(c: PContext; n: PNode): PNode =
|
||||
result = c.graph.emptyNode
|
||||
if not isTopLevel(c): localError(c.config, n.info, errXOnlyAtModuleScope % "using")
|
||||
for i in countup(0, sonsLen(n)-1):
|
||||
for i in 0 ..< sonsLen(n):
|
||||
var a = n.sons[i]
|
||||
if c.config.cmd == cmdIdeTools: suggestStmt(c, a)
|
||||
if a.kind == nkCommentStmt: continue
|
||||
|
|
@ -430,7 +430,7 @@ proc setVarType(c: PContext; v: PSym, typ: PType) =
|
|||
proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
|
||||
var b: PNode
|
||||
result = copyNode(n)
|
||||
for i in countup(0, sonsLen(n)-1):
|
||||
for i in 0 ..< sonsLen(n):
|
||||
var a = n.sons[i]
|
||||
if c.config.cmd == cmdIdeTools: suggestStmt(c, a)
|
||||
if a.kind == nkCommentStmt: continue
|
||||
|
|
@ -572,7 +572,7 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
|
|||
proc semConst(c: PContext, n: PNode): PNode =
|
||||
result = copyNode(n)
|
||||
inc c.inStaticContext
|
||||
for i in countup(0, sonsLen(n) - 1):
|
||||
for i in 0 ..< sonsLen(n):
|
||||
var a = n.sons[i]
|
||||
if c.config.cmd == cmdIdeTools: suggestStmt(c, a)
|
||||
if a.kind == nkCommentStmt: continue
|
||||
|
|
@ -879,7 +879,7 @@ proc semCase(c: PContext, n: PNode; flags: TExprFlags): PNode =
|
|||
|
||||
localError(c.config, n.info, errSelectorMustBeOfCertainTypes)
|
||||
return
|
||||
for i in countup(1, sonsLen(n) - 1):
|
||||
for i in 1 ..< sonsLen(n):
|
||||
var x = n.sons[i]
|
||||
when defined(nimsuggest):
|
||||
if c.config.ideCmd == ideSug and exactEquals(c.config.m.trackPos, x.info) and caseTyp.kind == tyEnum:
|
||||
|
|
@ -948,7 +948,7 @@ proc semRaise(c: PContext, n: PNode): PNode =
|
|||
|
||||
proc addGenericParamListToScope(c: PContext, n: PNode) =
|
||||
if n.kind != nkGenericParams: illFormedAst(n, c.config)
|
||||
for i in countup(0, sonsLen(n)-1):
|
||||
for i in 0 ..< sonsLen(n):
|
||||
var a = n.sons[i]
|
||||
if a.kind == nkSym: addDecl(c, a.sym)
|
||||
else: illFormedAst(a, c.config)
|
||||
|
|
@ -965,7 +965,7 @@ proc typeSectionTypeName(c: PContext; n: PNode): PNode =
|
|||
proc typeSectionLeftSidePass(c: PContext, n: PNode) =
|
||||
# process the symbols on the left side for the whole type section, before
|
||||
# we even look at the type definitions on the right
|
||||
for i in countup(0, sonsLen(n) - 1):
|
||||
for i in 0 ..< sonsLen(n):
|
||||
var a = n.sons[i]
|
||||
when defined(nimsuggest):
|
||||
if c.config.cmd == cmdIdeTools:
|
||||
|
|
@ -1099,7 +1099,7 @@ proc checkCovariantParamsUsages(c: PContext; genericType: PType) =
|
|||
discard traverseSubTypes(c, body)
|
||||
|
||||
proc typeSectionRightSidePass(c: PContext, n: PNode) =
|
||||
for i in countup(0, sonsLen(n) - 1):
|
||||
for i in 0 ..< sonsLen(n):
|
||||
var a = n.sons[i]
|
||||
if a.kind == nkCommentStmt: continue
|
||||
if a.kind != nkTypeDef: illFormedAst(a, c.config)
|
||||
|
|
@ -1226,7 +1226,7 @@ proc checkForMetaFields(c: PContext; n: PNode) =
|
|||
internalAssert c.config, false
|
||||
|
||||
proc typeSectionFinalPass(c: PContext, n: PNode) =
|
||||
for i in countup(0, sonsLen(n) - 1):
|
||||
for i in 0 ..< sonsLen(n):
|
||||
var a = n.sons[i]
|
||||
if a.kind == nkCommentStmt: continue
|
||||
let name = typeSectionTypeName(c, a.sons[0])
|
||||
|
|
@ -1322,7 +1322,7 @@ proc semParamList(c: PContext, n, genericParams: PNode, s: PSym) =
|
|||
s.typ = semProcTypeNode(c, n, genericParams, nil, s.kind)
|
||||
|
||||
proc addParams(c: PContext, n: PNode, kind: TSymKind) =
|
||||
for i in countup(1, sonsLen(n)-1):
|
||||
for i in 1 ..< sonsLen(n):
|
||||
if n.sons[i].kind == nkSym: addParamOrResult(c, n.sons[i].sym, kind)
|
||||
else: illFormedAst(n, c.config)
|
||||
|
||||
|
|
@ -1358,7 +1358,7 @@ proc semProcAnnotation(c: PContext, prc: PNode;
|
|||
validPragmas: TSpecialWords): PNode =
|
||||
var n = prc.sons[pragmasPos]
|
||||
if n == nil or n.kind == nkEmpty: return
|
||||
for i in countup(0, n.len-1):
|
||||
for i in 0 ..< n.len:
|
||||
var it = n.sons[i]
|
||||
var key = if it.kind in nkPragmaCallKinds and it.len >= 1: it.sons[0] else: it
|
||||
|
||||
|
|
@ -1665,7 +1665,7 @@ type
|
|||
|
||||
proc hasObjParam(s: PSym): bool =
|
||||
var t = s.typ
|
||||
for col in countup(1, sonsLen(t)-1):
|
||||
for col in 1 ..< sonsLen(t):
|
||||
if skipTypes(t.sons[col], skipPtrs).kind == tyObject:
|
||||
return true
|
||||
|
||||
|
|
@ -1679,7 +1679,7 @@ proc semMethodPrototype(c: PContext; s: PSym; n: PNode) =
|
|||
var foundObj = false
|
||||
# we start at 1 for now so that tparsecombnum continues to compile.
|
||||
# XXX Revisit this problem later.
|
||||
for col in countup(1, sonsLen(tt)-1):
|
||||
for col in 1 ..< sonsLen(tt):
|
||||
let t = tt.sons[col]
|
||||
if t != nil and t.kind == tyGenericInvocation:
|
||||
var x = skipTypes(t.sons[0], {tyVar, tyLent, tyPtr, tyRef, tyGenericInst,
|
||||
|
|
@ -2006,7 +2006,7 @@ proc incMod(c: PContext, n: PNode, it: PNode, includeStmtResult: PNode) =
|
|||
proc evalInclude(c: PContext, n: PNode): PNode =
|
||||
result = newNodeI(nkStmtList, n.info)
|
||||
addSon(result, n)
|
||||
for i in countup(0, sonsLen(n) - 1):
|
||||
for i in 0 ..< sonsLen(n):
|
||||
var imp: PNode
|
||||
let it = n.sons[i]
|
||||
if it.kind == nkInfix and it.len == 3 and it[2].kind == nkBracket:
|
||||
|
|
@ -2095,7 +2095,7 @@ proc semStmtList(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
|||
#while last > 0 and n.sons[last].kind in {nkPragma, nkCommentStmt,
|
||||
# nkNilLit, nkEmpty}:
|
||||
# dec last
|
||||
for i in countup(0, length - 1):
|
||||
for i in 0 ..< length:
|
||||
var expr = semExpr(c, n.sons[i], flags)
|
||||
n.sons[i] = expr
|
||||
if c.matchedConcept != nil and expr.typ != nil and
|
||||
|
|
@ -2131,7 +2131,7 @@ proc semStmtList(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
|||
if n.sons[i].kind in LastBlockStmts or
|
||||
n.sons[i].kind in nkCallKinds and n.sons[i][0].kind == nkSym and
|
||||
sfNoReturn in n.sons[i][0].sym.flags:
|
||||
for j in countup(i + 1, length - 1):
|
||||
for j in i + 1 ..< length:
|
||||
case n.sons[j].kind
|
||||
of nkPragma, nkCommentStmt, nkNilLit, nkEmpty, nkBlockExpr,
|
||||
nkBlockStmt, nkState: discard
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue