case consistency part 1

This commit is contained in:
Araq 2013-12-27 15:48:53 +01:00
commit 2df9b442c6
88 changed files with 1266 additions and 1144 deletions

View file

@ -50,7 +50,7 @@ proc sameInstantiation(a, b: TInstantiation): bool =
flags = {TypeDescExactMatch}): return
result = true
proc GenericCacheGet(genericSym: Psym, entry: TInstantiation): PSym =
proc genericCacheGet(genericSym: Psym, entry: TInstantiation): PSym =
if genericSym.procInstCache != nil:
for inst in genericSym.procInstCache:
if sameInstantiation(entry, inst[]):
@ -257,7 +257,7 @@ proc fixupProcType(c: PContext, genericType: PType,
result.sons[i] = fixupProcType(c, result.sons[i], inst)
result = instGenericContainer(c, getInfoContext(-1), result)
else: nil
else: discard
proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
info: TLineInfo): PSym =
@ -290,7 +290,7 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
instantiateGenericParamList(c, n.sons[genericParamsPos], pt, entry[])
result.typ = fixupProcType(c, fn.typ, entry[])
n.sons[genericParamsPos] = ast.emptyNode
var oldPrc = GenericCacheGet(fn, entry[])
var oldPrc = genericCacheGet(fn, entry[])
if oldPrc == nil:
fn.procInstCache.safeAdd(entry)
c.generics.add(makeInstPair(fn, entry))
@ -311,5 +311,3 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
c.friendModule = oldFriend
dec(c.InstCounter)
if result.kind == skMethod: finishMethod(c, result)