From c9c6741cde6d6945f276dde954533f68cc66c573 Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 3 Apr 2019 10:10:06 +0200 Subject: [PATCH] newruntime: fixes codegen for closures --- compiler/liftdestructors.nim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/liftdestructors.nim b/compiler/liftdestructors.nim index c778b04714..8ea28fea0d 100644 --- a/compiler/liftdestructors.nim +++ b/compiler/liftdestructors.nim @@ -373,6 +373,7 @@ proc closureOp(c: var TLiftCtx; t: PType; body, x, y: PNode) = body.add newAsgnStmt(x, call) elif optNimV2 in c.graph.config.globalOptions: let xx = genBuiltin(c.graph, mAccessEnv, "accessEnv", x) + xx.typ = getSysType(c.graph, c.info, tyPointer) case c.kind of attachedSink: # we 'nil' y out afterwards so we *need* to take over its reference @@ -389,6 +390,7 @@ proc closureOp(c: var TLiftCtx; t: PType; body, x, y: PNode) = proc ownedClosureOp(c: var TLiftCtx; t: PType; body, x, y: PNode) = let xx = genBuiltin(c.graph, mAccessEnv, "accessEnv", x) + xx.typ = getSysType(c.graph, c.info, tyPointer) var actions = newNodeI(nkStmtList, c.info) let elemType = t.lastSon discard addDestructorCall(c, elemType, newNodeI(nkStmtList, c.info), genDeref(xx))