infer static parameters even when more complicated arithmetic is involved
This commit is contained in:
parent
0b0a3e5f20
commit
0f2c4be129
10 changed files with 139 additions and 48 deletions
|
|
@ -1581,7 +1581,7 @@ proc hasPattern*(s: PSym): bool {.inline.} =
|
|||
result = isRoutine(s) and s.ast.sons[patternPos].kind != nkEmpty
|
||||
|
||||
iterator items*(n: PNode): PNode =
|
||||
for i in 0.. <n.len: yield n.sons[i]
|
||||
for i in 0.. <n.safeLen: yield n.sons[i]
|
||||
|
||||
iterator pairs*(n: PNode): tuple[i: int, n: PNode] =
|
||||
for i in 0.. <n.len: yield (i, n.sons[i])
|
||||
|
|
@ -1624,6 +1624,16 @@ proc toObject*(typ: PType): PType =
|
|||
if result.kind == tyRef:
|
||||
result = result.lastSon
|
||||
|
||||
proc findUnresolvedStatic*(n: PNode): PNode =
|
||||
if n.kind == nkSym and n.typ.kind == tyStatic and n.typ.n == nil:
|
||||
return n
|
||||
|
||||
for son in n:
|
||||
let n = son.findUnresolvedStatic
|
||||
if n != nil: return n
|
||||
|
||||
return nil
|
||||
|
||||
when false:
|
||||
proc containsNil*(n: PNode): bool =
|
||||
# only for debugging
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue