renamed inCompilesContext to compilesContextId; added test case for #3313

This commit is contained in:
Araq 2015-09-18 11:29:43 +02:00
commit c921f30b1d
7 changed files with 112 additions and 14 deletions

View file

@ -250,14 +250,14 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
if tfTriggersCompileTime in result.typ.flags:
incl(result.flags, sfCompileTime)
n.sons[genericParamsPos] = ast.emptyNode
var oldPrc = genericCacheGet(fn, entry[], c.inCompilesContext)
var oldPrc = genericCacheGet(fn, entry[], c.compilesContextId)
if oldPrc == nil:
# we MUST not add potentially wrong instantiations to the caching mechanism.
# This means recursive instantiations behave differently when in
# a ``compiles`` context but this is the lesser evil. See
# bug #1055 (tevilcompiles).
#if c.inCompilesContext == 0:
entry.compilesId = c.inCompilesContext
#if c.compilesContextId == 0:
entry.compilesId = c.compilesContextId
fn.procInstCache.safeAdd(entry)
c.generics.add(makeInstPair(fn, entry))
if n.sons[pragmasPos].kind != nkEmpty: