parent
496bd790e1
commit
0f91b67f5c
2 changed files with 9 additions and 4 deletions
|
|
@ -88,7 +88,7 @@ proc checkIsolate*(n: PNode): bool =
|
||||||
# XXX: as long as we don't update the analysis while examining arguments
|
# XXX: as long as we don't update the analysis while examining arguments
|
||||||
# we can do an early check of the return type, otherwise this is a
|
# we can do an early check of the return type, otherwise this is a
|
||||||
# bug and needs to be moved below
|
# bug and needs to be moved below
|
||||||
if n[0].typ.flags * {tfGcSafe, tfNoSideEffect} == {}:
|
if tfNoSideEffect notin n[0].typ.flags:
|
||||||
return false
|
return false
|
||||||
for i in 1..<n.len:
|
for i in 1..<n.len:
|
||||||
if checkIsolate(n[i]):
|
if checkIsolate(n[i]):
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,17 @@
|
||||||
discard """
|
discard """
|
||||||
errormsg: "expression cannot be isolated: select(a, b)"
|
errormsg: "expression cannot be isolated: select(a, b)"
|
||||||
line: 34
|
line: 39
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import std / isolation
|
import std / isolation
|
||||||
|
|
||||||
import json, streams
|
import json, streams
|
||||||
|
|
||||||
|
proc myParseJson(s: Stream; filename: string): JsonNode =
|
||||||
|
{.cast(noSideEffect).}:
|
||||||
|
result = parseJson(s, filename)
|
||||||
|
|
||||||
|
|
||||||
proc f(): seq[int] =
|
proc f(): seq[int] =
|
||||||
@[1, 2, 3]
|
@[1, 2, 3]
|
||||||
|
|
||||||
|
|
@ -28,7 +33,7 @@ proc main =
|
||||||
discard isolate select(Node(x: "a"), nil)
|
discard isolate select(Node(x: "a"), nil)
|
||||||
discard isolate select(Node(x: "a"), Node(x: "b"))
|
discard isolate select(Node(x: "a"), Node(x: "b"))
|
||||||
|
|
||||||
discard isolate parseJson(newFileStream("my.json"), "my.json")
|
discard isolate myParseJson(newFileStream("my.json"), "my.json")
|
||||||
|
|
||||||
var a, b: Node
|
var a, b: Node
|
||||||
discard isolate select(a, b)
|
discard isolate select(a, b)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue