don't emit an implicit try finally when in system.nim in order to prevent endless recursions in the try handler

This commit is contained in:
Araq
2019-04-09 11:22:23 +02:00
parent 0a01f5b655
commit da6ff14184

View File

@@ -995,7 +995,8 @@ proc genTry(p: BProc, t: PNode, d: var TLoc) =
#
if not isEmptyType(t.typ) and d.k == locNone:
getTemp(p, t.typ, d)
let quirkyExceptions = isDefined(p.config, "nimQuirky")
let quirkyExceptions = isDefined(p.config, "nimQuirky") or
(t.kind == nkHiddenTryStmt and sfSystemModule in p.module.module.flags)
if not quirkyExceptions:
p.module.includeHeader("<setjmp.h>")
genLineDir(p, t)