diff --git a/compiler/cursor_inference.nim b/compiler/cursor_inference.nim index e0999b5be1..224131270a 100644 --- a/compiler/cursor_inference.nim +++ b/compiler/cursor_inference.nim @@ -35,6 +35,7 @@ type mutations: IntSet reassigns: IntSet config: ConfigRef + inAsgnSource: int proc locationRoot(e: PNode; followDotExpr = true): PSym = var n = e @@ -221,7 +222,9 @@ proc analyse(c: var Con; n: PNode) = of nkAsgn, nkFastAsgn: analyse(c, n[0]) + inc c.inAsgnSource analyse(c, n[1]) + dec c.inAsgnSource if n[0].kind == nkSym: if hasDestructor(n[0].typ): @@ -252,14 +255,16 @@ proc analyse(c: var Con; n: PNode) = c.mutations.incl r.id of nkTupleConstr, nkBracket, nkObjConstr: - for i in ord(n.kind == nkObjConstr).. 0: + for i in ord(n.kind == nkObjConstr)..