diff options
author | Araq <rumpf_a@web.de> | 2013-05-31 01:27:03 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-05-31 01:27:03 +0200 |
commit | 8c211113f26260896614b7385b94ed91a5b9f291 (patch) | |
tree | 184835f828a10ec0b177599f55da4e3d39e42ac8 /compiler | |
parent | a8ba628bcd2535bc55e3bf67737e93ae99906a63 (diff) | |
download | Nim-8c211113f26260896614b7385b94ed91a5b9f291.tar.gz |
better error message for subtle nil errors
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/cgen.nim | 2 | ||||
-rw-r--r-- | compiler/options.nim | 2 |
2 files changed, 3 insertions, 1 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)) diff --git a/compiler/options.nim b/compiler/options.nim index f67ded163..6d93048fe 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -92,7 +92,7 @@ var gOptions*: TOptions = {optObjCheck, optFieldCheck, optRangeCheck, optBoundsCheck, optOverflowCheck, optAssert, optWarns, optHints, optStackTrace, optLineTrace, - optPatterns} + optPatterns, optNilCheck} gGlobalOptions*: TGlobalOptions = {optThreadAnalysis} gExitcode*: int8 gCmd*: TCommands = cmdNone # the command |