parent
49d1822c8f
commit
d56848878c
5 changed files with 25 additions and 5 deletions
|
|
@ -352,6 +352,8 @@ proc passCopyToSink(n: PNode; c: var Con): PNode =
|
|||
("passing '$1' to a sink parameter introduces an implicit copy; " &
|
||||
"use 'move($1)' to prevent it") % $n)
|
||||
else:
|
||||
if c.graph.config.selectedGC in {gcArc, gcOrc}:
|
||||
assert(not containsGarbageCollectedRef(n.typ))
|
||||
result.add newTree(nkAsgn, tmp, p(n, c, normal))
|
||||
result.add tmp
|
||||
|
||||
|
|
|
|||
|
|
@ -656,7 +656,7 @@ proc fillBody(c: var TLiftCtx; t: PType; body, x, y: PNode) =
|
|||
of tyTuple:
|
||||
fillBodyTup(c, t, body, x, y)
|
||||
of tyVarargs, tyOpenArray:
|
||||
if c.kind == attachedDestructor:
|
||||
if c.kind == attachedDestructor and (tfHasAsgn in t.flags or useNoGc(c, t)):
|
||||
forallElements(c, t, body, x, y)
|
||||
else:
|
||||
discard "cannot copy openArray"
|
||||
|
|
|
|||
|
|
@ -907,9 +907,15 @@ proc track(tracked: PEffects, n: PNode) =
|
|||
nkMacroDef, nkTemplateDef, nkLambda, nkDo, nkFuncDef:
|
||||
discard
|
||||
of nkCast, nkHiddenStdConv, nkHiddenSubConv, nkConv:
|
||||
if n.len == 2: track(tracked, n[1])
|
||||
if n.len == 2:
|
||||
track(tracked, n[1])
|
||||
if tracked.owner.kind != skMacro:
|
||||
createTypeBoundOps(tracked, n.typ, n.info)
|
||||
of nkObjUpConv, nkObjDownConv, nkChckRange, nkChckRangeF, nkChckRange64:
|
||||
if n.len == 1: track(tracked, n[0])
|
||||
if n.len == 1:
|
||||
track(tracked, n[0])
|
||||
if tracked.owner.kind != skMacro:
|
||||
createTypeBoundOps(tracked, n.typ, n.info)
|
||||
of nkBracket:
|
||||
for i in 0..<n.safeLen: track(tracked, n[i])
|
||||
if tracked.owner.kind != skMacro:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue