real bugfix for #17170 (#18171)

* real bugfix for #17170

* better fix
This commit is contained in:
Andreas Rumpf 2021-06-04 16:20:47 +02:00 • committed by GitHub
commit 5423915e5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -414,8 +414,11 @@ proc exprToStmtList(n: PNode): tuple[s, res: PNode] =
proc newEnvVarAsgn(ctx: Ctx, s: PSym, v: PNode): PNode =
result = newTree(nkFastAsgn, ctx.newEnvVarAccess(s), v)
result.info = v.info
if isEmptyType(v.typ):
result = v
else:
result = newTree(nkFastAsgn, ctx.newEnvVarAccess(s), v)
result.info = v.info
proc addExprAssgn(ctx: Ctx, output, input: PNode, sym: PSym) =
if input.kind == nkStmtListExpr:
@ -427,8 +430,7 @@ proc addExprAssgn(ctx: Ctx, output, input: PNode, sym: PSym) =
proc convertExprBodyToAsgn(ctx: Ctx, exprBody: PNode, res: PSym): PNode =
result = newNodeI(nkStmtList, exprBody.info)
if exprBody.typ != nil:
ctx.addExprAssgn(result, exprBody, res)
ctx.addExprAssgn(result, exprBody, res)
proc newNotCall(g: ModuleGraph; e: PNode): PNode =
result = newTree(nkCall, newSymNode(g.getSysMagic(e.info, "not", mNot), e.info), e)