Avoids usefulFact recursion with nil parameter. Fixes #518.

This commit is contained in:
Grzegorz Adam Hankiewicz
2013-07-09 23:31:13 +02:00
parent dbb87bc557
commit 172945de31

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)