fix detecting closure env for nested asts (#14326)

Co-authored-by: b3liever <b3liever@yandex.com>
This commit is contained in:
b3liever 2020-05-12 21:09:56 +03:00 • committed by GitHub
commit 09ea8f9cf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,7 +26,7 @@ import
strutils, options, dfa, lowerings, tables, modulegraphs, msgs, strutils, options, dfa, lowerings, tables, modulegraphs, msgs,
lineinfos, parampatterns, sighashes, liftdestructors lineinfos, parampatterns, sighashes, liftdestructors
from trees import exprStructuralEquivalent from trees import exprStructuralEquivalent, getRoot
from algorithm import reverse from algorithm import reverse
const const
@ -383,8 +383,8 @@ proc sinkParamIsLastReadCheck(c: var Con, s: PNode) =
"` is already consumed at " & toFileLineCol(c. graph.config, s.info)) "` is already consumed at " & toFileLineCol(c. graph.config, s.info))
proc isCapturedVar(n: PNode): bool = proc isCapturedVar(n: PNode): bool =
n.kind == nkDotExpr and n[0].kind == nkHiddenDeref and let root = getRoot(n)
n[0][0].kind == nkSym and n[0][0].sym.name.s[0] == ':' if root != nil: result = root.name.s[0] == ':'
proc passCopyToSink(n: PNode; c: var Con): PNode = proc passCopyToSink(n: PNode; c: var Con): PNode =
result = newNodeIT(nkStmtListExpr, n.info, n.typ) result = newNodeIT(nkStmtListExpr, n.info, n.typ)