fixes #20219; ignore comment/empty node in stmtListExpr (#20249)

This commit is contained in:
ringabout
2022-08-24 15:28:46 +08:00
committed by GitHub
parent 0014b9c48e
commit 9d9ecc3c1d

View File

@@ -320,6 +320,10 @@ proc isSimpleExpr(p: PProc; n: PNode): bool =
for c in n:
if not p.isSimpleExpr(c): return false
result = true
elif n.kind == nkStmtListExpr:
for i in 0..<n.len-1:
if n[i].kind notin {nkCommentStmt, nkEmpty}: return false
result = isSimpleExpr(p, n.lastSon)
elif n.isAtom:
result = true