Skip to content

Commit

Permalink
fixes #12956
Browse files Browse the repository at this point in the history
  • Loading branch information
Araq committed Jan 3, 2020
1 parent a577a88 commit 7101c8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion compiler/closureiters.nim
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,8 @@ proc transformReturnsInTry(ctx: var Ctx, n: PNode): PNode =
if n[0].kind != nkEmpty:
let asgnTmpResult = newNodeI(nkAsgn, n.info)
asgnTmpResult.add(ctx.newTmpResultAccess())
asgnTmpResult.add(n[0])
let x = if n[0].kind in {nkAsgn, nkFastAsgn}: n[0][1] else: n[0]
asgnTmpResult.add(x)
result.add(asgnTmpResult)

result.add(ctx.newNullifyCurExc(n.info))
Expand Down
3 changes: 2 additions & 1 deletion compiler/injectdestructors.nim
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ proc genCopy(c: var Con; dest, ri: PNode): PNode =
# try to improve the error message here:
if c.otherRead == nil: discard isLastRead(ri, c)
checkForErrorPragma(c, t, ri, "=")
genCopyNoCheck(c, dest, ri)
result = genCopyNoCheck(c, dest, ri)

proc genDestroy(c: Con; dest: PNode): PNode =
let t = dest.typ.skipTypes({tyGenericInst, tyAlias, tySink})
Expand Down Expand Up @@ -571,6 +571,7 @@ proc p(n: PNode; c: var Con; mode: ProcessMode): PNode =
else:
if n[0].kind in {nkDotExpr, nkCheckedFieldExpr}:
cycleCheck(n, c)
assert n[1].kind notin {nkAsgn, nkFastAsgn}
result = moveOrCopy(n[0], n[1], c, isFirstWrite = false)
else:
result = copyNode(n)
Expand Down

0 comments on commit 7101c8c

Please sign in to comment.