summary refs log tree commit diff stats
path: root/compiler/cgen.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-05-31 01:27:03 +0200
committerAraq <rumpf_a@web.de>2013-05-31 01:27:03 +0200
commit8c211113f26260896614b7385b94ed91a5b9f291 (patch)
tree184835f828a10ec0b177599f55da4e3d39e42ac8 /compiler/cgen.nim
parenta8ba628bcd2535bc55e3bf67737e93ae99906a63 (diff)
downloadNim-8c211113f26260896614b7385b94ed91a5b9f291.tar.gz
better error message for subtle nil errors
Diffstat (limited to 'compiler/cgen.nim')
-rw-r--r--compiler/cgen.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 92216d278..7e782fc12 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -346,6 +346,8 @@ proc resetLoc(p: BProc, loc: var TLoc) =
     else:
       linefmt(p, cpsStmts, "$1 = 0;$n", rdLoc(loc))
   else:
+    if optNilCheck in p.options:
+      linefmt(p, cpsStmts, "#chckNil((void*)$1);$n", addrLoc(loc))
     if loc.s != OnStack:
       linefmt(p, cpsStmts, "#genericReset((void*)$1, $2);$n",
               addrLoc(loc), genTypeInfo(p.module, loc.t))