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
commit 9d9ecc3c1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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