parent
de7f2372be
commit
ae4ede6b00
5 changed files with 144 additions and 4 deletions
|
|
@ -392,9 +392,18 @@ proc deps(c: var Partitions; dest, src: PNode) =
|
|||
analyseAsgn(c, c.s[vid], src)
|
||||
# do not borrow from a different local variable, this is easier
|
||||
# than tracking reassignments, consider 'var cursor = local; local = newNode()'
|
||||
if src.kind == nkSym and (src.sym.kind in {skVar, skResult, skTemp} or
|
||||
if src.kind == nkSym:
|
||||
if (src.sym.kind in {skVar, skResult, skTemp} or
|
||||
(src.sym.kind in {skLet, skParam, skForVar} and hasDisabledAsgn(src.sym.typ))):
|
||||
c.s[vid].flags.incl preventCursor
|
||||
c.s[vid].flags.incl preventCursor
|
||||
elif src.sym.kind in {skVar, skResult, skTemp, skLet, skForVar}:
|
||||
# XXX: we need to compute variable alive ranges before doing anything else:
|
||||
let srcid = variableId(c, src.sym)
|
||||
if srcid >= 0 and preventCursor in c.s[srcid].flags:
|
||||
# you cannot borrow from a local that lives shorter than 'vid':
|
||||
if c.s[srcid].aliveStart > c.s[vid].aliveStart or
|
||||
c.s[srcid].aliveEnd < c.s[vid].aliveEnd:
|
||||
c.s[vid].flags.incl preventCursor
|
||||
|
||||
if src.kind == nkSym and hasDestructor(src.typ):
|
||||
rhsIsSink(c, src)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue