diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-11-05 22:47:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-05 22:47:12 +0800 |
commit | afd4e22f76bc2234ea660a110376839d726770f7 (patch) | |
tree | f55e31409b9ba418dba7fe3980508e375466471d | |
parent | 10e7f18d01780c500d2cfc8827e6557579fe3236 (diff) | |
download | Nim-afd4e22f76bc2234ea660a110376839d726770f7.tar.gz |
Revert "fix arc global variable issues" (#20764)
* Revert "fix arc global variable issues (#20759)" This reverts commit a3d32a4176539d0829a4e868f4b005a1a71eb7ee. * trigger documentation builds
-rw-r--r-- | .github/workflows/ci_docs.yml | 1 | ||||
-rw-r--r-- | compiler/injectdestructors.nim | 7 | ||||
-rw-r--r-- | tests/arc/tarcmisc.nim | 2 |
3 files changed, 4 insertions, 6 deletions
diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 6228c48c8..cde30e5fa 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -14,6 +14,7 @@ on: - 'tools/kochdocs.nim' - '.github/workflows/ci_docs.yml' - 'koch.nim' + pull_request: # Run only on changes on these files. paths: diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim index eda73eeb5..ad43e23fc 100644 --- a/compiler/injectdestructors.nim +++ b/compiler/injectdestructors.nim @@ -490,11 +490,8 @@ 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: #XXX: Rethink this logic (see tarcmisc.test2) - if c.inLoop > 0: - s.final.add c.genDestroy(v) - else: - c.graph.globalDestructors.add c.genDestroy(v) + if sfGlobal in v.sym.flags and s.parent == nil: #XXX: Rethink this logic (see tarcmisc.test2) + c.graph.globalDestructors.add c.genDestroy(v) else: s.final.add c.genDestroy(v) diff --git a/tests/arc/tarcmisc.nim b/tests/arc/tarcmisc.nim index 3160d8a4d..567daf982 100644 --- a/tests/arc/tarcmisc.nim +++ b/tests/arc/tarcmisc.nim @@ -124,7 +124,7 @@ proc test(count: int) = test(3) proc test2(count: int) = - block: #XXX: Fails with block currently + #block: #XXX: Fails with block currently var v {.global.} = newVariable(20) var count = count - 1 |