diff options
author | Clyybber <darkmine956@gmail.com> | 2019-09-09 11:54:15 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-09-09 11:54:15 +0200 |
commit | ed1d41c51e5b3772fdea9e08733dbf46dfb4428e (patch) | |
tree | 48add0b4f759aad5f212894000424df82751eeaa /compiler/suggest.nim | |
parent | aa95ae6af93e04c5465d76347ab2150bf13d9669 (diff) | |
download | Nim-ed1d41c51e5b3772fdea9e08733dbf46dfb4428e.tar.gz |
Small ast.nim cleanup (#12156)
* Remove sonsLen * Use Indexable
Diffstat (limited to 'compiler/suggest.nim')
-rw-r--r-- | compiler/suggest.nim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/suggest.nim b/compiler/suggest.nim index 5cb365a4a..a254c1f13 100644 --- a/compiler/suggest.nim +++ b/compiler/suggest.nim @@ -275,7 +275,7 @@ template wholeSymTab(cond, section: untyped) {.dirty.} = pm, c.inTypeContext > 0, scopeN)) proc suggestSymList(c: PContext, list, f: PNode; info: TLineInfo, outputs: var Suggestions) = - for i in 0 ..< sonsLen(list): + for i in 0 ..< len(list): if list.sons[i].kind == nkSym: suggestField(c, list.sons[i].sym, f, info, outputs) #else: InternalError(list.info, "getSymFromList") @@ -283,9 +283,9 @@ proc suggestSymList(c: PContext, list, f: PNode; info: TLineInfo, outputs: var S proc suggestObject(c: PContext, n, f: PNode; info: TLineInfo, outputs: var Suggestions) = case n.kind of nkRecList: - for i in 0 ..< sonsLen(n): suggestObject(c, n.sons[i], f, info, outputs) + for i in 0 ..< len(n): suggestObject(c, n.sons[i], f, info, outputs) of nkRecCase: - var L = sonsLen(n) + var L = len(n) if L > 0: suggestObject(c, n.sons[0], f, info, outputs) for i in 1 ..< L: suggestObject(c, lastSon(n.sons[i]), f, info, outputs) @@ -318,7 +318,7 @@ proc suggestCall(c: PContext, n, nOrig: PNode, outputs: var Suggestions) = ideCon) proc typeFits(c: PContext, s: PSym, firstArg: PType): bool {.inline.} = - if s.typ != nil and sonsLen(s.typ) > 1 and s.typ.sons[1] != nil: + if s.typ != nil and len(s.typ) > 1 and s.typ.sons[1] != nil: # special rule: if system and some weird generic match via 'tyUntyped' # or 'tyGenericParam' we won't list it either to reduce the noise (nobody # wants 'system.`-|` as suggestion @@ -595,7 +595,7 @@ proc suggestExprNoCheck*(c: PContext, n: PNode) = var x = safeSemExpr(c, n.sons[0]) if x.kind == nkEmpty or x.typ == nil: x = n.sons[0] addSon(a, x) - for i in 1..sonsLen(n)-1: + for i in 1..len(n)-1: # use as many typed arguments as possible: var x = safeSemExpr(c, n.sons[i]) if x.kind == nkEmpty or x.typ == nil: break |