bugfix: 'defined/compiles' open an implicit mixin scope in generics

This commit is contained in:
Araq 2012-09-18 16:27:02 +02:00
commit 4892d6929a
4 changed files with 15 additions and 8 deletions

View file

@ -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