Skip to content

Commit

Permalink
fixes nim-lang#12577 [backport] (nim-lang#12584)
Browse files Browse the repository at this point in the history
  • Loading branch information
Araq authored Nov 3, 2019
1 parent 4e0f120 commit ceda586
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions compiler/lambdalifting.nim
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ proc liftIterSym*(g: ModuleGraph; n: PNode; owner: PSym): PNode =
result.add(v)
# add 'new' statement:
result.add newCall(getSysSym(g, n.info, "internalNew"), env)
if g.config.selectedGC in {gcHooks, gcDestructors}:
createTypeBoundOpsLL(g, env.typ, n.info)
createTypeBoundOpsLL(g, env.typ, n.info)
result.add makeClosure(g, iter, env, n.info)

proc freshVarForClosureIter*(g: ModuleGraph; s, owner: PSym): PNode =
Expand Down Expand Up @@ -613,8 +612,7 @@ proc rawClosureCreation(owner: PSym;
localError(d.graph.config, env.info, "internal error: cannot create up reference")
# we are not in the sem'check phase anymore! so pass 'nil' for the PContext
# and hope for the best:
if d.graph.config.selectedGC in {gcHooks, gcDestructors}:
createTypeBoundOpsLL(d.graph, env.typ, owner.info)
createTypeBoundOpsLL(d.graph, env.typ, owner.info)

proc finishClosureCreation(owner: PSym; d: DetectionPass; c: LiftingPass;
info: TLineInfo; res: PNode) =
Expand Down Expand Up @@ -642,8 +640,7 @@ proc closureCreationForIter(iter: PNode;
addVar(vs, vnode)
result.add(vs)
result.add(newCall(getSysSym(d.graph, iter.info, "internalNew"), vnode))
if d.graph.config.selectedGC in {gcHooks, gcDestructors}:
createTypeBoundOpsLL(d.graph, vnode.typ, iter.info)
createTypeBoundOpsLL(d.graph, vnode.typ, iter.info)

let upField = lookupInRecord(v.typ.skipTypes({tyOwned, tyRef, tyPtr}).n, getIdent(d.graph.cache, upName))
if upField != nil:
Expand Down Expand Up @@ -928,8 +925,7 @@ proc liftForLoop*(g: ModuleGraph; body: PNode; owner: PSym): PNode =
result.add(v)
# add 'new' statement:
result.add(newCall(getSysSym(g, env.info, "internalNew"), env.newSymNode))
if g.config.selectedGC in {gcHooks, gcDestructors}:
createTypeBoundOpsLL(g, env.typ, body.info)
createTypeBoundOpsLL(g, env.typ, body.info)

elif op.kind == nkStmtListExpr:
let closure = op.lastSon
Expand Down

0 comments on commit ceda586

Please sign in to comment.