[isolation]fix empty ref object bug (#17471)
* fix nim js cmp fails at CT * [Minor]fix empty ref object for isolation * Update compiler/isolation_check.nim * Update compiler/isolation_check.nim Co-authored-by: Clyybber <darkmine956@gmail.com> Co-authored-by: Clyybber <darkmine956@gmail.com>
This commit is contained in:
parent
13a2030014
commit
465a41c308
2 changed files with 14 additions and 2 deletions
|
|
@ -100,7 +100,12 @@ proc checkIsolate*(n: PNode): bool =
|
|||
for it in n:
|
||||
result = checkIsolate(it.lastSon)
|
||||
if not result: break
|
||||
of nkCaseStmt, nkObjConstr:
|
||||
of nkCaseStmt:
|
||||
for i in 1..<n.len:
|
||||
result = checkIsolate(n[i].lastSon)
|
||||
if not result: break
|
||||
of nkObjConstr:
|
||||
result = true
|
||||
for i in 1..<n.len:
|
||||
result = checkIsolate(n[i].lastSon)
|
||||
if not result: break
|
||||
|
|
@ -123,4 +128,3 @@ proc checkIsolate*(n: PNode): bool =
|
|||
else:
|
||||
# no ref, no cry:
|
||||
result = true
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,14 @@ import std/[isolation, json]
|
|||
|
||||
|
||||
proc main() =
|
||||
block:
|
||||
type
|
||||
Empty = ref object
|
||||
|
||||
|
||||
var x = isolate(Empty())
|
||||
discard extract(x)
|
||||
|
||||
block: # string literals
|
||||
var data = isolate("string")
|
||||
doAssert data.extract == "string"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue