summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-12-17 19:30:43 +0100
committerAraq <rumpf_a@web.de>2012-12-17 19:30:43 +0100
commit3be576222a2e2a774570eb408d43c35ab94c5f15 (patch)
tree5b5430b217a449e50eba2a93f2e7ed5d4e23c720 /compiler
parente516571b47a8dd4c72333adcd04228f81ec02a8d (diff)
downloadNim-3be576222a2e2a774570eb408d43c35ab94c5f15.tar.gz
fixes #277; documentation improvements
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/ccgstmts.nim4
-rwxr-xr-xcompiler/cgen.nim2
2 files changed, 4 insertions, 2 deletions
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim
index 089f7fb83..9d5659f5e 100755
--- a/compiler/ccgstmts.nim
+++ b/compiler/ccgstmts.nim
@@ -124,6 +124,7 @@ proc genBreakState(p: BProc, n: PNode) =
     lineF(p, cpsStmts, "if ((((NI*) $1.ClEnv)[0]) < 0) break;$n", [rdLoc(a)])
   #  lineF(p, cpsStmts, "if (($1) < 0) break;$n", [rdLoc(a)])
 
+proc genVarPrototypeAux(m: BModule, sym: PSym)
 proc genSingleVar(p: BProc, a: PNode) =
   var v = a.sons[0].sym
   if sfCompileTime in v.flags: return
@@ -142,6 +143,9 @@ proc genSingleVar(p: BProc, a: PNode) =
     genObjectInit(p.module.preInitProc, cpsInit, v.typ, v.loc, true)
     # Alternative construction using default constructor (which may zeromem):
     # if sfImportc notin v.flags: constructLoc(p.module.preInitProc, v.loc)
+    if sfExportc in v.flags and generatedHeader != nil:
+      genVarPrototypeAux(generatedHeader, v)
+
   else:
     assignLocalVar(p, v)
     initLocalVar(p, v, immediateAsgn)
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 5bdbefde1..d024f3479 100755
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -799,8 +799,6 @@ proc genVarPrototypeAux(m: BModule, sym: PSym) =
 
 proc genVarPrototype(m: BModule, sym: PSym) =
   genVarPrototypeAux(m, sym)
-  if sfExportc in sym.flags and generatedHeader != nil:
-    genVarPrototypeAux(generatedHeader, sym)
 
 proc addIntTypes(result: var PRope) {.inline.} =
   appf(result, "#define NIM_INTBITS $1", [