summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndrii Riabushenko <cdome@bk.ru>2018-12-05 21:45:01 +0000
committerAndrii Riabushenko <cdome@bk.ru>2018-12-05 21:45:01 +0000
commit268461f06ea8b03c1b72c25163418076df22b88d (patch)
tree6298cf636c6fe43ba1de1c735b891e436cbf32f3 /compiler
parent972707440ad0837d3de11cc6d60abbd3dc7ace75 (diff)
downloadNim-268461f06ea8b03c1b72c25163418076df22b88d.tar.gz
add comment
Diffstat (limited to 'compiler')
-rw-r--r--compiler/destroyer.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/destroyer.nim b/compiler/destroyer.nim
index 59ee5dcb6..3811cccad 100644
--- a/compiler/destroyer.nim
+++ b/compiler/destroyer.nim
@@ -620,7 +620,8 @@ proc p(n: PNode; c: var Con): PNode =
   of nkAsgn, nkFastAsgn:
     if hasDestructor(n[0].typ):
       result = moveOrCopy(n[0], n[1], c)
-      c.enableDestructor(n[0].sym)
+      c.enableDestructor(n[0].sym) # last read to sink argument could have disabled the destructor
+                                   # but the variable is assigned again and new value should be destroyed
     else:
       result = copyNode(n)
       recurse(n, result)