summary refs log tree commit diff stats
path: root/rod/ccgstmts.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-03-12 12:38:42 +0100
committerAraq <rumpf_a@web.de>2011-03-12 12:38:42 +0100
commit6850fb73c1b9ae8d3f56a61ee37922c3cb3788d6 (patch)
tree3454e74ca1e27fd6f39bfd2d1fd15e86cbbbb731 /rod/ccgstmts.nim
parent0fee9f9924cbbb6b18191d9c731542feac1ac682 (diff)
downloadNim-6850fb73c1b9ae8d3f56a61ee37922c3cb3788d6.tar.gz
fixes #20
Diffstat (limited to 'rod/ccgstmts.nim')
-rwxr-xr-xrod/ccgstmts.nim7
1 files changed, 3 insertions, 4 deletions
diff --git a/rod/ccgstmts.nim b/rod/ccgstmts.nim
index 2b649a270..572b60143 100755
--- a/rod/ccgstmts.nim
+++ b/rod/ccgstmts.nim
@@ -42,6 +42,7 @@ proc genVarTuple(p: BProc, n: PNode) =
     v = n.sons[i].sym
     if sfGlobal in v.flags: 
       assignGlobalVar(p, v)
+      genObjectInit(p, cpsInit, v.typ, v.loc, true)
     else: 
       assignLocalVar(p, v)
       initVariable(p, v)
@@ -53,7 +54,6 @@ proc genVarTuple(p: BProc, n: PNode) =
       field.r = ropef("$1.$2", 
                       [rdLoc(tup), mangleRecFieldName(t.n.sons[i].sym, t)])
     putLocIntoDest(p, v.loc, field)
-    genObjectInit(p, v.typ, v.loc, true)
 
 proc genVarStmt(p: BProc, n: PNode) = 
   for i in countup(0, sonsLen(n) - 1): 
@@ -64,14 +64,13 @@ proc genVarStmt(p: BProc, n: PNode) =
       var v = a.sons[0].sym
       if sfGlobal in v.flags: 
         assignGlobalVar(p, v)
+        genObjectInit(p, cpsInit, v.typ, v.loc, true)
       else: 
         assignLocalVar(p, v)
-        initVariable(p, v)    # XXX: this is not required if a.sons[2] != nil,
-                              # unless it is a GC'ed pointer
+        initVariable(p, v)
       if a.sons[2].kind != nkEmpty: 
         genLineDir(p, a)
         expr(p, a.sons[2], v.loc)
-      genObjectInit(p, v.typ, v.loc, true) # correct position
     else: 
       genVarTuple(p, a)