mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 13:33:22 +00:00
Merge pull request #519 from gradha/pr_guards_against_nil_ast
Avoids usefulFact recursion with nil parameter. Fixes #518.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user