ARC: handle closures like tuples consistently

This commit is contained in:
Araq
2019-11-13 13:26:39 +01:00
committed by Andreas Rumpf
parent 3020e49b75
commit bcab3ed06c

View File

@@ -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):
@@ -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