summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-08-24 15:28:46 +0800
committerGitHub <noreply@github.com>2022-08-24 09:28:46 +0200
commit9d9ecc3c1d774a71b4b866d7e503b25c307e7cbf (patch)
tree8d1110344e994bff35de5d3c997b933defafe51e /compiler
parent0014b9c48e883d3c04995b9e83bb0f8468a16df6 (diff)
downloadNim-9d9ecc3c1d774a71b4b866d7e503b25c307e7cbf.tar.gz
fixes #20219; ignore comment/empty node in stmtListExpr (#20249)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/jsgen.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim
index b30d03579..39009bd2f 100644
--- a/compiler/jsgen.nim
+++ b/compiler/jsgen.nim
@@ -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