ARC: fixes cycle detection and move the .cursor attribute into closures (#12872)

This commit is contained in:
Andreas Rumpf 2019-12-11 06:57:00 +01:00 • committed by GitHub
commit 3524944e21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 1 deletions

View file

@ -422,7 +422,8 @@ proc cycleCheck(n: PNode; c: var Con) =
var field: PNode = nil
while true:
if x.kind == nkDotExpr:
if field == nil: field = x[1]
field = x[1]
if field.kind == nkSym and sfCursor in field.sym.flags: return
x = x[0]
elif x.kind in {nkBracketExpr, nkCheckedFieldExpr, nkDerefExpr, nkHiddenDeref}:
x = x[0]