Skip to content

Commit

Permalink
Help compiler infer gc safety
Browse files Browse the repository at this point in the history
  • Loading branch information
GULPF committed Apr 18, 2019
1 parent 872d044 commit ebc1b4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nimquery.nim
Expand Up @@ -640,7 +640,7 @@ proc validateNth(a, b, nSiblings: int): bool =
return n.floor == n and n >= 0

proc satisfies(pair: NodeWithParent, demands: seq[Demand]): bool
{.raises: [Defect].}
{.raises: [Defect], gcsafe.}

proc satisfies(pair: NodeWithParent, demand: Demand): bool =
let node = pair.node
Expand Down
7 changes: 7 additions & 0 deletions tests/tests.nim
Expand Up @@ -535,3 +535,10 @@ test "numeric class name":
test "issue1":
let els = xml.querySelectorAll("#issue1 p")
check($els == "@[<p>1</p>, <p>2</p>, <p>3</p>, <p>4</p>]")

block checkIfGcSafe:
proc foo =
let xml = parseHtml(newStringStream(html))
discard xml.querySelector("p")

let bar: proc() {.gcsafe.} = foo

0 comments on commit ebc1b4a

Please sign in to comment.