Small ast.nim cleanup (#12156)

* Remove sonsLen
* Use Indexable
This commit is contained in:
Clyybber 2019-09-09 11:54:15 +02:00 • committed by Andreas Rumpf
commit ed1d41c51e
54 changed files with 559 additions and 573 deletions

View file

@ -380,7 +380,7 @@ proc trackTryStmt(tracked: PEffects, n: PNode) =
# Collect the exceptions caught by the except branches
for i in 1 ..< n.len:
let b = n.sons[i]
let blen = sonsLen(b)
let blen = len(b)
if b.kind == nkExceptBranch:
inc branches
if blen == 1:
@ -398,7 +398,7 @@ proc trackTryStmt(tracked: PEffects, n: PNode) =
# Add any other exception raised in the except bodies
for i in 1 ..< n.len:
let b = n.sons[i]
let blen = sonsLen(b)
let blen = len(b)
if b.kind == nkExceptBranch:
setLen(tracked.init, oldState)
track(tracked, b.sons[blen-1])
@ -430,7 +430,7 @@ proc isForwardedProc(n: PNode): bool =
result = n.kind == nkSym and sfForward in n.sym.flags
proc trackPragmaStmt(tracked: PEffects, n: PNode) =
for i in 0 ..< sonsLen(n):
for i in 0 ..< len(n):
var it = n.sons[i]
if whichPragma(it) == wEffects:
# list the computed effects up to here: