diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-04-28 13:28:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-28 13:28:18 +0200 |
commit | 55aa2129b5b32c0bb9862c66d3ebbd681f727274 (patch) | |
tree | 38d8ac59d6829d283a1d56504a1e972d87c5e1bb /compiler/dfa.nim | |
parent | a432aedb5457f113d2389bfd09fbb20fd6eafc9b (diff) | |
download | Nim-55aa2129b5b32c0bb9862c66d3ebbd681f727274.tar.gz |
make twidgets example green (#11135)
Diffstat (limited to 'compiler/dfa.nim')
-rw-r--r-- | compiler/dfa.nim | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler/dfa.nim b/compiler/dfa.nim index 45e1aaffe..17c480b66 100644 --- a/compiler/dfa.nim +++ b/compiler/dfa.nim @@ -633,13 +633,19 @@ proc instrTargets*(ins: Instr; loc: PNode): bool = # use x; question does it affect 'x.f'? Yes. result = aliases(ins.n, loc) or aliases(loc, ins.n) -proc isAnalysableFieldAccess*(n: PNode; owner: PSym): bool = - var n = n +proc isAnalysableFieldAccess*(orig: PNode; owner: PSym): bool = + var n = orig while true: case n.kind of nkDotExpr, nkCheckedFieldExpr, nkHiddenSubConv, nkHiddenStdConv, - nkObjDownConv, nkObjUpConv, nkHiddenDeref: + nkObjDownConv, nkObjUpConv: + n = n[0] + of nkHiddenDeref, nkDerefExpr: + # We "own" sinkparam[].loc but not ourVar[].location as it is a nasty + # pointer indirection. n = n[0] + return n.kind == nkSym and n.sym.owner == owner and (isSinkParam(n.sym) or + n.sym.typ.skipTypes(abstractInst-{tyOwned}).kind in {tyOwned, tyVar}) of nkBracketExpr: let x = n[0] if x.typ != nil and x.typ.skipTypes(abstractInst).kind == tyTuple: |