summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorBung <crc32@qq.com>2022-11-06 18:47:35 +0800
committerGitHub <noreply@github.com>2022-11-06 11:47:35 +0100
commitfdc8dd41288c78052c21796b7e65e37cba71d316 (patch)
tree87b3cb8b2c606a953789af4bc79cefba5a905aa7 /compiler
parent93b085a57ad28c71056dd3da6c4daa56ef4713c4 (diff)
downloadNim-fdc8dd41288c78052c21796b7e65e37cba71d316.tar.gz
Arc global (#20768)
* temp

* unsure

* fix condition

* port macro arc runable examples to one file

* trigger doc ci

* fix

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
Diffstat (limited to 'compiler')
-rw-r--r--compiler/injectdestructors.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim
index ad43e23fc..c245d8d6b 100644
--- a/compiler/injectdestructors.nim
+++ b/compiler/injectdestructors.nim
@@ -490,7 +490,7 @@ proc pVarTopLevel(v: PNode; c: var Con; s: var Scope; res: PNode) =
       res.add newTree(nkFastAsgn, v, genDefaultCall(v.typ, c, v.info))
   elif sfThread notin v.sym.flags and sfCursor notin v.sym.flags:
     # do not destroy thread vars for now at all for consistency.
-    if sfGlobal in v.sym.flags and s.parent == nil: #XXX: Rethink this logic (see tarcmisc.test2)
+    if {sfGlobal, sfPure} <= v.sym.flags or sfGlobal in v.sym.flags and s.parent == nil:
       c.graph.globalDestructors.add c.genDestroy(v)
     else:
       s.final.add c.genDestroy(v)