Merge pull request #519 from gradha/pr_guards_against_nil_ast

Avoids usefulFact recursion with nil parameter. Fixes #518.
This commit is contained in:
Araq
2013-07-09 15:05:46 -07:00

View File

@@ -187,7 +187,8 @@ proc usefulFact(n: PNode): PNode =
# if a:
# ...
# We make can easily replace 'a' by '2 < x' here:
result = usefulFact(n.sym.ast)
if n.sym.ast != nil:
result = usefulFact(n.sym.ast)
elif n.kind == nkStmtListExpr:
result = usefulFact(n.lastSon)