From 64e74cf4848d9a53074916b5705713855ab755db Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 2 Nov 2011 19:47:33 +0100 Subject: [PATCH] bugfix: code gen for constant sequences --- compiler/ccgexprs.nim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index c9be31830..c0da213c7 100755 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -1874,8 +1874,13 @@ proc genConstSimpleList(p: BProc, n: PNode): PRope = proc genConstSeq(p: BProc, n: PNode, t: PType): PRope = var data = ropef("{{$1, $1}", n.len.toRope) - for i in countup(0, n.len - 1): - appf(data, ",$1$n", [genConstExpr(p, n.sons[i])]) + if n.len > 0: + # array part needs extra curlies: + data.app(", {") + for i in countup(0, n.len - 1): + if i > 0: data.appf(",$n") + data.app genConstExpr(p, n.sons[i]) + data.app("}") data.app("}") inc(gBackendId)