strict funcs: use control flow information for a more precise analysis (#15271)
* strict funcs: use control flow information for a more precise analysis * cursor inference uses control flow information
This commit is contained in:
parent
072c655653
commit
2f6d04fd5d
2 changed files with 87 additions and 23 deletions
|
|
@ -1,9 +1,9 @@
|
|||
discard """
|
||||
errormsg: "'mutate' can have side effects"
|
||||
nimout: '''an object reachable from 'n' is potentially mutated
|
||||
tfuncs_cannot_mutate.nim(34, 15) the mutation is here
|
||||
tfuncs_cannot_mutate.nim(32, 7) is the statement that connected the mutation to the parameter'''
|
||||
line: 28
|
||||
tfuncs_cannot_mutate.nim(39, 15) the mutation is here
|
||||
tfuncs_cannot_mutate.nim(37, 7) is the statement that connected the mutation to the parameter'''
|
||||
line: 33
|
||||
"""
|
||||
|
||||
{.experimental: "strictFuncs".}
|
||||
|
|
@ -13,6 +13,11 @@ type
|
|||
le, ri: Node
|
||||
data: string
|
||||
|
||||
func insert(x: var seq[Node]; yyy: Node) =
|
||||
let L = x.len
|
||||
x.setLen L + 1
|
||||
x[L] = yyy
|
||||
|
||||
func len(n: Node): int =
|
||||
var it = n
|
||||
while it != nil:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue