fixes 3354
This commit is contained in:
parent
2210060965
commit
10a4bb6f4e
1 changed files with 8 additions and 2 deletions
|
|
@ -859,11 +859,17 @@ proc transformOuterProc(o: POuterContext, n: PNode; it: TIter): PNode =
|
||||||
return indirectAccess(newSymNode(it.closureParam), local, n.info)
|
return indirectAccess(newSymNode(it.closureParam), local, n.info)
|
||||||
|
|
||||||
if local.kind == skClosureIterator:
|
if local.kind == skClosureIterator:
|
||||||
|
# bug #3354; allow for
|
||||||
|
#iterator iter(): int {.closure.}=
|
||||||
|
# s.add(iter)
|
||||||
|
# yield 1
|
||||||
|
|
||||||
|
#if local == o.fn or local == it.fn:
|
||||||
|
# message(n.info, errRecursiveDependencyX, local.name.s)
|
||||||
|
|
||||||
# consider: [i1, i2, i1] Since we merged the iterator's closure
|
# consider: [i1, i2, i1] Since we merged the iterator's closure
|
||||||
# with the captured owning variables, we need to generate the
|
# with the captured owning variables, we need to generate the
|
||||||
# closure generation code again:
|
# closure generation code again:
|
||||||
if local == o.fn or local == it.fn:
|
|
||||||
message(n.info, errRecursiveDependencyX, local.name.s)
|
|
||||||
# XXX why doesn't this work?
|
# XXX why doesn't this work?
|
||||||
var closure = PEnv(idTableGet(o.lambdasToEnv, local))
|
var closure = PEnv(idTableGet(o.lambdasToEnv, local))
|
||||||
if closure.isNil:
|
if closure.isNil:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue