summary refs log tree commit diff stats
path: root/compiler/injectdestructors.nim
diff options
context:
space:
mode:
authorAntonis <b3liever@yandex.com>2020-05-11 14:51:50 +0300
committerAndreas Rumpf <rumpf_a@web.de>2020-05-11 15:39:44 +0200
commit3616b0698baf230fec7a60cd90c72b979e582179 (patch)
tree75f467ff5e019297a3b1f59181bfb01fcb379f6d /compiler/injectdestructors.nim
parent73c9d2c9d745e4396dbfc9e9422acdfa7809b705 (diff)
downloadNim-3616b0698baf230fec7a60cd90c72b979e582179.tar.gz
fix closure env check
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 ea1a97e24..9ed3d4189 100644
--- a/compiler/injectdestructors.nim
+++ b/compiler/injectdestructors.nim
@@ -382,7 +382,8 @@ proc sinkParamIsLastReadCheck(c: var Con, s: PNode) =
     localError(c.graph.config, c.otherRead.info, "sink parameter `" & $s.sym.name.s &
         "` is already consumed at " & toFileLineCol(c. graph.config, s.info))
 
-proc isClosureEnv(n: PNode): bool = n.kind == nkSym and n.sym.name.s[0] == ':'
+proc isClosureEnv(n: PNode): bool =
+  n.kind == nkDotExpr and n[0].kind == nkHiddenDeref and n[0][0].typ.kind == tyRef
 
 proc passCopyToSink(n: PNode; c: var Con): PNode =
   result = newNodeIT(nkStmtListExpr, n.info, n.typ)