From bcab3ed06c2c4996f7efac6e7733b514ad83e1d4 Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 13 Nov 2019 13:26:39 +0100 Subject: [PATCH] ARC: handle closures like tuples consistently --- compiler/injectdestructors.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim index 96b4e52403..08d27f77c3 100644 --- a/compiler/injectdestructors.nim +++ b/compiler/injectdestructors.nim @@ -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