summary refs log tree commit diff stats
path: root/compiler/ccgexprs.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-10-16 20:29:16 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-10-16 20:29:16 +0200
commit9485f1c888422bc39f6f6b0e06e5dc230636be06 (patch)
tree1cbd2069a47a6e8231664c00cfdc7a63bfd69475 /compiler/ccgexprs.nim
parent527e20fd3a0f2cc13afcfb0d402b77087c94c3ee (diff)
downloadNim-9485f1c888422bc39f6f6b0e06e5dc230636be06.tar.gz
make tests green again
Diffstat (limited to 'compiler/ccgexprs.nim')
-rw-r--r--compiler/ccgexprs.nim9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim
index 008599727..12e457e90 100644
--- a/compiler/ccgexprs.nim
+++ b/compiler/ccgexprs.nim
@@ -978,9 +978,12 @@ proc genEcho(p: BProc, n: PNode) =
     p.module.includeHeader("<base/log.h>")
     linefmt(p, cpsStmts, """Genode::log(""$1);$n""", args)
   else:
-    var a: TLoc
-    initLocExpr(p, n, a)
-    linefmt(p, cpsStmts, "#echoBinSafe($1, $2);$n", a.rdLoc, n.len.rope)
+    if n.len == 0:
+      linefmt(p, cpsStmts, "#echoBinSafe(NIM_NIL, $1);$n", n.len.rope)
+    else:
+      var a: TLoc
+      initLocExpr(p, n, a)
+      linefmt(p, cpsStmts, "#echoBinSafe($1, $2);$n", a.rdLoc, n.len.rope)
     when false:
       p.module.includeHeader("<stdio.h>")
       linefmt(p, cpsStmts, "printf($1$2);$n",