[bugfix] owned closures (#11544)

This commit is contained in:
Andreas Rumpf 2019-06-20 07:40:45 +02:00 • committed by GitHub
commit c65a5d754b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 102 additions and 30 deletions

View file

@ -78,6 +78,13 @@ proc nimRawDispose(p: pointer) {.compilerRtl.} =
proc nimDestroyAndDispose(p: pointer) {.compilerRtl.} =
let d = cast[ptr PNimType](p)[].destructor
if d != nil: cast[DestructorProc](d)(p)
when false:
cstderr.rawWrite cast[ptr PNimType](p)[].name
cstderr.rawWrite "\n"
if d == nil:
cstderr.rawWrite "bah, nil\n"
else:
cstderr.rawWrite "has destructor!\n"
nimRawDispose(p)
proc isObj(obj: PNimType, subclass: cstring): bool {.compilerproc.} =