disable DOM API when using ARC (ref #85)

This commit is contained in:
Felix Krause 2021-05-18 00:42:58 +02:00
parent 1346467b42
commit d20707c4e4
3 changed files with 16 additions and 3 deletions

View File

@ -4,4 +4,8 @@
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
import tlex, tjson, tserialization, tdom, tparser, tquickstart, tannotations
import tlex, tjson, tserialization, tparser, tquickstart, tannotations
when not defined(gcArc) or defined(gcOrc):
import tdom

View File

@ -38,8 +38,14 @@
## * The hints API in `hints <yaml.hints.html>`_ provides a simple proc for
## guessing the type of a scalar value.
import yaml / [dom, hints, parser, presenter, annotations,
import yaml / [hints, parser, presenter, annotations,
serialization, stream, taglib, tojson]
export dom, hints, parser, presenter, annotations,
when not defined(gcArc) or defined(gcOrc):
# YAML DOM may contain cycles and therefore will leak memory if used with
# ARC but without ORC. In that case it won't be available.
import yaml/dom
export dom
export hints, parser, presenter, annotations,
serialization, stream, taglib, tojson

View File

@ -23,6 +23,9 @@ import tables, streams, hashes, sets, strutils
import data, stream, taglib, serialization, private/internal, parser,
presenter
when defined(gcArc) and not defined(gcOrc):
{.error: "NimYAML's DOM API only supports ORC because ARC can't deal with cycles".}
when defined(nimNoNil):
{.experimental: "notnil".}
type