parent
7e21218a07
commit
5423915e5a
2 changed files with 8 additions and 4 deletions
|
|
@ -414,8 +414,11 @@ proc exprToStmtList(n: PNode): tuple[s, res: PNode] =
|
||||||
|
|
||||||
|
|
||||||
proc newEnvVarAsgn(ctx: Ctx, s: PSym, v: PNode): PNode =
|
proc newEnvVarAsgn(ctx: Ctx, s: PSym, v: PNode): PNode =
|
||||||
result = newTree(nkFastAsgn, ctx.newEnvVarAccess(s), v)
|
if isEmptyType(v.typ):
|
||||||
result.info = v.info
|
result = v
|
||||||
|
else:
|
||||||
|
result = newTree(nkFastAsgn, ctx.newEnvVarAccess(s), v)
|
||||||
|
result.info = v.info
|
||||||
|
|
||||||
proc addExprAssgn(ctx: Ctx, output, input: PNode, sym: PSym) =
|
proc addExprAssgn(ctx: Ctx, output, input: PNode, sym: PSym) =
|
||||||
if input.kind == nkStmtListExpr:
|
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 =
|
proc convertExprBodyToAsgn(ctx: Ctx, exprBody: PNode, res: PSym): PNode =
|
||||||
result = newNodeI(nkStmtList, exprBody.info)
|
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 =
|
proc newNotCall(g: ModuleGraph; e: PNode): PNode =
|
||||||
result = newTree(nkCall, newSymNode(g.getSysMagic(e.info, "not", mNot), e.info), e)
|
result = newTree(nkCall, newSymNode(g.getSysMagic(e.info, "not", mNot), e.info), e)
|
||||||
|
|
|
||||||
|
|
@ -364,6 +364,7 @@ proc genMarkCyclic(c: var Con; result, dest: PNode) =
|
||||||
proc genCopyNoCheck(c: var Con; dest, ri: PNode): PNode =
|
proc genCopyNoCheck(c: var Con; dest, ri: PNode): PNode =
|
||||||
let t = dest.typ.skipTypes({tyGenericInst, tyAlias, tySink})
|
let t = dest.typ.skipTypes({tyGenericInst, tyAlias, tySink})
|
||||||
result = c.genOp(t, attachedAsgn, dest, ri)
|
result = c.genOp(t, attachedAsgn, dest, ri)
|
||||||
|
assert ri.typ != nil
|
||||||
|
|
||||||
proc genCopy(c: var Con; dest, ri: PNode): PNode =
|
proc genCopy(c: var Con; dest, ri: PNode): PNode =
|
||||||
let t = dest.typ
|
let t = dest.typ
|
||||||
|
|
@ -371,6 +372,7 @@ proc genCopy(c: var Con; dest, ri: PNode): PNode =
|
||||||
# try to improve the error message here:
|
# try to improve the error message here:
|
||||||
c.checkForErrorPragma(t, ri, "=copy")
|
c.checkForErrorPragma(t, ri, "=copy")
|
||||||
result = c.genCopyNoCheck(dest, ri)
|
result = c.genCopyNoCheck(dest, ri)
|
||||||
|
assert ri.typ != nil
|
||||||
|
|
||||||
proc genDiscriminantAsgn(c: var Con; s: var Scope; n: PNode): PNode =
|
proc genDiscriminantAsgn(c: var Con; s: var Scope; n: PNode): PNode =
|
||||||
# discriminator is ordinal value that doesn't need sink destroy
|
# discriminator is ordinal value that doesn't need sink destroy
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue