From 8c211113f26260896614b7385b94ed91a5b9f291 Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 31 May 2013 01:27:03 +0200 Subject: better error message for subtle nil errors --- compiler/cgen.nim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'compiler/cgen.nim') 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)) -- cgit 1.4.1-2-gfad0