diff options
author | Araq <rumpf_a@web.de> | 2019-11-09 20:33:23 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2019-11-09 20:33:23 +0100 |
commit | e835377d3fd85bf50db549d3b4b6e20dbca85c47 (patch) | |
tree | 04564fe459986d988d6171cf48840cf04325be87 /compiler/injectdestructors.nim | |
parent | 82e0765fc903f6014baa08104bc66bff80a28132 (diff) | |
download | Nim-e835377d3fd85bf50db549d3b4b6e20dbca85c47.tar.gz |
inhibit silly warning about moving closure environments for performance
Diffstat (limited to 'compiler/injectdestructors.nim')
-rw-r--r-- | compiler/injectdestructors.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim index 247a71d33..b6dbf797c 100644 --- a/compiler/injectdestructors.nim +++ b/compiler/injectdestructors.nim @@ -275,6 +275,8 @@ proc p(n: PNode; c: var Con): PNode proc pArg(arg: PNode; c: var Con; isSink: bool): PNode proc moveOrCopy(dest, ri: PNode; c: var Con): PNode +proc isClosureEnv(n: PNode): bool = n.kind == nkSym and n.sym.name.s[0] == ':' + proc passCopyToSink(n: PNode; c: var Con): PNode = result = newNodeIT(nkStmtListExpr, n.info, n.typ) let tmp = getTemp(c, n.typ, n.info) @@ -285,7 +287,7 @@ proc passCopyToSink(n: PNode; c: var Con): PNode = var m = genCopy(c, tmp, n) m.add p(n, c) result.add m - if isLValue(n): + if isLValue(n) and not isClosureEnv(n): message(c.graph.config, n.info, hintPerformance, ("passing '$1' to a sink parameter introduces an implicit copy; " & "use 'move($1)' to prevent it") % $n) |