Perform nil checks during object construction and within compiles()

Close https://github.com/nim-lang/Nim/issues/6494
This commit is contained in:
Zahary Karadjov 2020-03-29 20:31:37 +03:00 • committed by Andreas Rumpf
commit 4f3d309fb0
4 changed files with 10 additions and 7 deletions

View file

@ -2082,7 +2082,10 @@ proc tryExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
var err: string
try:
result = semExpr(c, n, flags)
if c.config.errorCounter != oldErrorCount: result = nil
if result != nil:
trackStmt(c, c.module, result, isTopLevel = false)
if c.config.errorCounter != oldErrorCount:
result = nil
except ERecoverableError:
discard
# undo symbol table changes (as far as it's possible):