diff options
author | Araq <rumpf_a@web.de> | 2019-11-13 13:26:39 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-11-13 23:29:21 +0100 |
commit | bcab3ed06c2c4996f7efac6e7733b514ad83e1d4 (patch) | |
tree | 23b0cacb903327b68dfbc7501e2ed0d97d486c05 /compiler/injectdestructors.nim | |
parent | 3020e49b7554c1bd465811864cb781abdd89ec0b (diff) | |
download | Nim-bcab3ed06c2c4996f7efac6e7733b514ad83e1d4.tar.gz |
ARC: handle closures like tuples consistently
Diffstat (limited to 'compiler/injectdestructors.nim')
-rw-r--r-- | compiler/injectdestructors.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim index 96b4e5240..08d27f77c 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 |