summary refs log tree commit diff stats
path: root/rod/rnimsyn.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <andreas@andreas-laptop>2010-07-21 09:44:47 +0200
committerAndreas Rumpf <andreas@andreas-laptop>2010-07-21 09:44:47 +0200
commitd10973adb00840631e5314ec902d502f15934801 (patch)
treea207854b0cf984815beb26bf2d71933ce566f6d7 /rod/rnimsyn.nim
parentc441cdb64ca5394f74faadf76563bcfafeda18f4 (diff)
downloadNim-d10973adb00840631e5314ec902d502f15934801.tar.gz
c2nim tool added
Diffstat (limited to 'rod/rnimsyn.nim')
-rwxr-xr-xrod/rnimsyn.nim10
1 files changed, 8 insertions, 2 deletions
diff --git a/rod/rnimsyn.nim b/rod/rnimsyn.nim
index 60cfd38b1..d0c7dc9e3 100755
--- a/rod/rnimsyn.nim
+++ b/rod/rnimsyn.nim
@@ -615,13 +615,19 @@ proc gproc(g: var TSrcGen, n: PNode) =
 proc gblock(g: var TSrcGen, n: PNode) = 
   var c: TContext
   initContext(c)
-  putWithSpace(g, tkBlock, "block")
-  gsub(g, n.sons[0])
+  if n.sons[0] != nil:
+    putWithSpace(g, tkBlock, "block")
+    gsub(g, n.sons[0])
+  else:
+    put(g, tkBlock, "block")
   putWithSpace(g, tkColon, ":")
   if longMode(n) or (lsub(n.sons[1]) + g.lineLen > maxLineLen): 
     incl(c.flags, rfLongMode)
   gcoms(g)
+  # XXX I don't get why this is needed here! gstmts should already handle this!
+  indentNL(g)
   gstmts(g, n.sons[1], c)
+  dedent(g)
 
 proc gasm(g: var TSrcGen, n: PNode) = 
   putWithSpace(g, tkAsm, "asm")