fixes #14495 [backport:1.2] (#14496)

(cherry picked from commit 3105909f88)
This commit is contained in:
Andreas Rumpf
2020-05-29 23:35:57 +02:00
committed by narimiran
parent 051f4ffad9
commit aec0d583d1
2 changed files with 88 additions and 4 deletions

View File

@@ -515,8 +515,8 @@ proc atomicRefOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =
body.add genIf(c, cond, actions)
body.add newAsgnStmt(x, y)
of attachedDestructor:
actions.add newAsgnStmt(x, newNodeIT(nkNilLit, body.info, t))
body.add genIf(c, cond, actions)
body.add newAsgnStmt(x, newNodeIT(nkNilLit, body.info, t))
of attachedDeepCopy: assert(false, "cannot happen")
of attachedTrace:
if isFinal(elemType):
@@ -564,8 +564,8 @@ proc atomicClosureOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =
body.add genIf(c, cond, actions)
body.add newAsgnStmt(x, y)
of attachedDestructor:
actions.add newAsgnStmt(xenv, newNodeIT(nkNilLit, body.info, xenv.typ))
body.add genIf(c, cond, actions)
body.add newAsgnStmt(xenv, newNodeIT(nkNilLit, body.info, xenv.typ))
of attachedDeepCopy: assert(false, "cannot happen")
of attachedTrace:
body.add callCodegenProc(c.g, "nimTraceRefDyn", c.info, genAddrOf(xenv), y)
@@ -622,8 +622,8 @@ proc ownedRefOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =
body.add genIf(c, x, actions)
body.add newAsgnStmt(x, y)
of attachedDestructor:
actions.add newAsgnStmt(x, newNodeIT(nkNilLit, body.info, t))
body.add genIf(c, x, actions)
body.add newAsgnStmt(x, newNodeIT(nkNilLit, body.info, t))
of attachedDeepCopy: assert(false, "cannot happen")
of attachedTrace, attachedDispose: discard
@@ -675,8 +675,8 @@ proc ownedClosureOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =
body.add genIf(c, xx, actions)
body.add newAsgnStmt(x, y)
of attachedDestructor:
actions.add newAsgnStmt(xx, newNodeIT(nkNilLit, body.info, xx.typ))
body.add genIf(c, xx, actions)
body.add newAsgnStmt(xx, newNodeIT(nkNilLit, body.info, xx.typ))
of attachedDeepCopy: assert(false, "cannot happen")
of attachedTrace, attachedDispose: discard