summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorb3liever <43617260+b3liever@users.noreply.github.com>2020-05-12 21:09:56 +0300
committerGitHub <noreply@github.com>2020-05-12 20:09:56 +0200
commit09ea8f9cf8ee796bdd5f8a803d30216e7aefa6ba (patch)
tree52aae97b11e5324a5b7ac03d428d216a3a739722 /compiler
parentdddfbcf211cd46453b78a9d207347a158311f85e (diff)
downloadNim-09ea8f9cf8ee796bdd5f8a803d30216e7aefa6ba.tar.gz
fix detecting closure env for nested asts (#14326)
Co-authored-by: b3liever <b3liever@yandex.com>
Diffstat (limited to 'compiler')
-rw-r--r--compiler/injectdestructors.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim
index 431f9539f..44409c760 100644
--- a/compiler/injectdestructors.nim
+++ b/compiler/injectdestructors.nim
@@ -26,7 +26,7 @@ import
   strutils, options, dfa, lowerings, tables, modulegraphs, msgs,
   lineinfos, parampatterns, sighashes, liftdestructors
 
-from trees import exprStructuralEquivalent
+from trees import exprStructuralEquivalent, getRoot
 from algorithm import reverse
 
 const
@@ -383,8 +383,8 @@ proc sinkParamIsLastReadCheck(c: var Con, s: PNode) =
         "` is already consumed at " & toFileLineCol(c. graph.config, s.info))
 
 proc isCapturedVar(n: PNode): bool =
-  n.kind == nkDotExpr and n[0].kind == nkHiddenDeref and
-      n[0][0].kind == nkSym and n[0][0].sym.name.s[0] == ':'
+  let root = getRoot(n)
+  if root != nil: result = root.name.s[0] == ':'
 
 proc passCopyToSink(n: PNode; c: var Con): PNode =
   result = newNodeIT(nkStmtListExpr, n.info, n.typ)