summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-09-18 16:27:02 +0200
committerAraq <rumpf_a@web.de>2012-09-18 16:27:02 +0200
commit4892d6929a5b60a004f5f9a12902ef4f7d37a9d8 (patch)
tree1999d4bc27ca07819e7645f45593772e1ab6a637 /compiler
parenta71c5f98ea92c4c9f96ffe9265600f9cc2b7a8ee (diff)
downloadNim-4892d6929a5b60a004f5f9a12902ef4f7d37a9d8.tar.gz
bugfix: 'defined/compiles' open an implicit mixin scope in generics
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/semgnrc.nim9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/semgnrc.nim b/compiler/semgnrc.nim
index a330e17e7..434dd7155 100755
--- a/compiler/semgnrc.nim
+++ b/compiler/semgnrc.nim
@@ -138,9 +138,12 @@ proc semGenericStmt(c: PContext, n: PNode,
       else:
         result.sons[0] = newSymNode(s, n.sons[0].info)
         first = 1
-    if not isDefinedMagic:
-      for i in countup(first, sonsLen(result) - 1): 
-        result.sons[i] = semGenericStmt(c, result.sons[i], flags, toBind)
+    # Consider 'when defined(globalsSlot): ThreadVarSetValue(globalsSlot, ...)'
+    # in threads.nim: the subtle preprocessing here binds 'globalsSlot' which 
+    # is not exported and yet the generic 'threadProcWrapper' works correctly.
+    let flags = if isDefinedMagic: flags+{withinMixin} else: flags
+    for i in countup(first, sonsLen(result) - 1):
+      result.sons[i] = semGenericStmt(c, result.sons[i], flags, toBind)
   of nkMacroStmt: 
     checkMinSonsLen(n, 2)
     var a: PNode