summary refs log tree commit diff stats
path: root/compiler/injectdestructors.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-12-11 06:57:00 +0100
committerGitHub <noreply@github.com>2019-12-11 06:57:00 +0100
commit3524944e215b1c1118a68d31a57a26e45b343328 (patch)
tree6454fa735280b0d11781111b9cbdce7093823b3e /compiler/injectdestructors.nim
parente61d702206d62fb47aa55f34f83f41264299c0a3 (diff)
downloadNim-3524944e215b1c1118a68d31a57a26e45b343328.tar.gz
ARC: fixes cycle detection and move the .cursor attribute into closures (#12872)
Diffstat (limited to 'compiler/injectdestructors.nim')
-rw-r--r--compiler/injectdestructors.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim
index 8a9b5d7b8..18fb0f5c8 100644
--- a/compiler/injectdestructors.nim
+++ b/compiler/injectdestructors.nim
@@ -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]