Skip to content

Commit

Permalink
ARC: handle closures like tuples consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
Araq committed Nov 13, 2019
1 parent 3020e49 commit bcab3ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/injectdestructors.nim
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ proc pArg(arg: PNode; c: var Con; isSink: bool): PNode =
# sink parameter (bug #11524). Note that the string implementation is
# different and can deal with 'const string sunk into var'.
result = passCopyToSink(arg, c)
elif arg.kind in {nkBracket, nkObjConstr, nkTupleConstr} + nkLiterals:
elif arg.kind in {nkBracket, nkObjConstr, nkTupleConstr, nkClosure} + nkLiterals:
# object construction to sink parameter: nothing to do
result = arg
elif arg.kind == nkSym and isSinkParam(arg.sym):
Expand Down Expand Up @@ -548,7 +548,7 @@ proc p(n: PNode; c: var Con): PNode =
proc moveOrCopy(dest, ri: PNode; c: var Con): PNode =
# unfortunately, this needs to be kept consistent with the cases
# we handle in the 'case of' statement below:
const movableNodeKinds = (nkCallKinds + {nkSym, nkTupleConstr, nkObjConstr,
const movableNodeKinds = (nkCallKinds + {nkSym, nkTupleConstr, nkClosure, nkObjConstr,
nkBracket, nkBracketExpr, nkNilLit})

case ri.kind
Expand Down

0 comments on commit bcab3ed

Please sign in to comment.