This commit is contained in:
Andreas Rumpf 2020-01-03 17:36:09 +01:00 • committed by GitHub
commit fb1b51f1e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -838,7 +838,8 @@ proc transformReturnsInTry(ctx: var Ctx, n: PNode): PNode =
if n[0].kind != nkEmpty: if n[0].kind != nkEmpty:
let asgnTmpResult = newNodeI(nkAsgn, n.info) let asgnTmpResult = newNodeI(nkAsgn, n.info)
asgnTmpResult.add(ctx.newTmpResultAccess()) 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(asgnTmpResult)
result.add(ctx.newNullifyCurExc(n.info)) result.add(ctx.newNullifyCurExc(n.info))

View file

@ -227,7 +227,7 @@ proc genCopy(c: var Con; dest, ri: PNode): PNode =
# try to improve the error message here: # try to improve the error message here:
if c.otherRead == nil: discard isLastRead(ri, c) if c.otherRead == nil: discard isLastRead(ri, c)
checkForErrorPragma(c, t, ri, "=") checkForErrorPragma(c, t, ri, "=")
genCopyNoCheck(c, dest, ri) result = genCopyNoCheck(c, dest, ri)
proc genDestroy(c: Con; dest: PNode): PNode = proc genDestroy(c: Con; dest: PNode): PNode =
let t = dest.typ.skipTypes({tyGenericInst, tyAlias, tySink}) let t = dest.typ.skipTypes({tyGenericInst, tyAlias, tySink})
@ -571,6 +571,7 @@ proc p(n: PNode; c: var Con; mode: ProcessMode): PNode =
else: else:
if n[0].kind in {nkDotExpr, nkCheckedFieldExpr}: if n[0].kind in {nkDotExpr, nkCheckedFieldExpr}:
cycleCheck(n, c) cycleCheck(n, c)
assert n[1].kind notin {nkAsgn, nkFastAsgn}
result = moveOrCopy(n[0], n[1], c, isFirstWrite = false) result = moveOrCopy(n[0], n[1], c, isFirstWrite = false)
else: else:
result = copyNode(n) result = copyNode(n)