summary refs log tree commit diff stats
path: root/compiler/destroyer.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-02-20 02:04:58 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-02-20 02:04:58 +0100
commitc025786b75f5c376737186590a50467c8639b0cf (patch)
tree236331f42cb48f6f811573d6e09fe495c1a2f501 /compiler/destroyer.nim
parent7e404c670d5ff55f4316b2ae0a6749161c4bb47d (diff)
downloadNim-c025786b75f5c376737186590a50467c8639b0cf.tar.gz
gc:destructors: sink parameters need to be destroyed properly
Diffstat (limited to 'compiler/destroyer.nim')
-rw-r--r--compiler/destroyer.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/destroyer.nim b/compiler/destroyer.nim
index 6c47c8884..0570873ea 100644
--- a/compiler/destroyer.nim
+++ b/compiler/destroyer.nim
@@ -139,7 +139,7 @@ proc isLastRead(s: PSym; c: var Con; pc, comesFrom: int): int =
     of def:
       if c.g[pc].sym == s:
         # the path lead to a redefinition of 's' --> abandon it.
-        return high(int) 
+        return high(int)
       inc pc
     of use:
       if c.g[pc].sym == s:
@@ -154,7 +154,7 @@ proc isLastRead(s: PSym; c: var Con; pc, comesFrom: int): int =
       if variantA < 0: return -1
       let variantB = isLastRead(s, c, pc + c.g[pc].dest, pc)
       if variantB < 0: return -1
-      elif variantA == high(int): 
+      elif variantA == high(int):
         variantA = variantB
       pc = variantA
     of InstrKind.join:
@@ -632,7 +632,7 @@ proc injectDestructorCalls*(g: ModuleGraph; owner: PSym; n: PNode): PNode =
     let params = owner.typ.n
     for i in 1 ..< params.len:
       let param = params[i].sym
-      if param.typ.kind == tySink and hasDestructor(param.typ):
+      if param.typ.kind == tySink and hasDestructor(param.typ.sons[0]):
         c.destroys.add genDestroy(c, param.typ.skipTypes({tyGenericInst, tyAlias, tySink}), params[i])
 
   let body = p(n, c)