diff options
author | Araq <rumpf_a@web.de> | 2015-05-02 23:53:48 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-05-03 01:08:51 +0200 |
commit | 6cb3635ca05cf5a95b3cc0751bb5f99d41a2e074 (patch) | |
tree | d6a22d3bd86212520a179ea5ff64b4d54a500c06 | |
parent | c6605d3d507d13bb6e2996d4eadfb5681cfdc193 (diff) | |
download | Nim-6cb3635ca05cf5a95b3cc0751bb5f99d41a2e074.tar.gz |
fixes 'echo nil' codegen bug
-rw-r--r-- | compiler/ccgexprs.nim | 7 | ||||
-rw-r--r-- | compiler/options.nim | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 93a9dd65d..05a3602d1 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -964,8 +964,11 @@ proc genEcho(p: BProc, n: PNode) = var args: Rope = nil var a: TLoc for i in countup(0, n.len-1): - initLocExpr(p, n.sons[i], a) - addf(args, ", $1? ($1)->data:\"nil\"", [rdLoc(a)]) + if n.sons[i].skipConv.kind == nkNilLit: + add(args, ", \"nil\"") + else: + initLocExpr(p, n.sons[i], a) + addf(args, ", $1? ($1)->data:\"nil\"", [rdLoc(a)]) linefmt(p, cpsStmts, "printf($1$2);$n", makeCString(repeat("%s", n.len) & tnl), args) diff --git a/compiler/options.nim b/compiler/options.nim index 65250f519..998ab7781 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -1,7 +1,7 @@ # # # The Nim Compiler -# (c) Copyright 2013 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. |