summary refs log tree commit diff stats
path: root/compiler/ccgstmts.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/ccgstmts.nim')
-rwxr-xr-xcompiler/ccgstmts.nim7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim
index 5a604ef98..7a2eaec9c 100755
--- a/compiler/ccgstmts.nim
+++ b/compiler/ccgstmts.nim
@@ -853,9 +853,10 @@ proc genStmts(p: BProc, t: PNode) =
     # transf is overly aggressive with 'nkFastAsgn', so we work around here.
     # See tests/run/tcnstseq3 for an example that would fail otherwise.
     genAsgn(p, t, fastAsgn=p.prc != nil)
-  of nkDiscardStmt: 
-    genLineDir(p, t)
-    initLocExpr(p, t.sons[0], a)
+  of nkDiscardStmt:
+    if t.sons[0].kind != nkEmpty:
+      genLineDir(p, t)
+      initLocExpr(p, t.sons[0], a)
   of nkAsmStmt: genAsmStmt(p, t)
   of nkTryStmt: 
     if gCmd == cmdCompileToCpp: genTryStmtCpp(p, t)