Dont produce initing moves for sfNoInit variables in closure env (#21026)
This commit is contained in:
parent
b83bd282dc
commit
c47d5196be
1 changed files with 4 additions and 1 deletions
|
|
@ -829,6 +829,9 @@ proc p(n: PNode; c: var Con; s: var Scope; mode: ProcessMode; tmpFlags = {sfSing
|
||||||
if ri.kind != nkEmpty:
|
if ri.kind != nkEmpty:
|
||||||
result.add moveOrCopy(v, ri, c, s, if v.kind == nkSym: {IsDecl} else: {})
|
result.add moveOrCopy(v, ri, c, s, if v.kind == nkSym: {IsDecl} else: {})
|
||||||
elif ri.kind == nkEmpty and c.inLoop > 0:
|
elif ri.kind == nkEmpty and c.inLoop > 0:
|
||||||
|
let skipInit = v.kind == nkDotExpr and # Closure var
|
||||||
|
sfNoInit in v[1].sym.flags
|
||||||
|
if not skipInit:
|
||||||
result.add moveOrCopy(v, genDefaultCall(v.typ, c, v.info), c, s, if v.kind == nkSym: {IsDecl} else: {})
|
result.add moveOrCopy(v, genDefaultCall(v.typ, c, v.info), c, s, if v.kind == nkSym: {IsDecl} else: {})
|
||||||
else: # keep the var but transform 'ri':
|
else: # keep the var but transform 'ri':
|
||||||
var v = copyNode(n)
|
var v = copyNode(n)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue