bugfix: proper cache for generic instantiations
This commit is contained in:
parent
81a917390b
commit
569c1ce5ec
24 changed files with 459 additions and 643 deletions
|
|
@ -134,15 +134,13 @@ proc semConstBoolExpr(c: PContext, n: PNode): PNode =
|
|||
include semtypes, semexprs, semgnrc, semstmts
|
||||
|
||||
proc addCodeForGenerics(c: PContext, n: PNode) =
|
||||
for i in countup(c.lastGenericIdx, sonsLen(c.generics) - 1):
|
||||
var it = c.generics.sons[i].sons[1]
|
||||
if it.kind != nkSym: InternalError("addCodeForGenerics")
|
||||
var prc = it.sym
|
||||
for i in countup(lastGenericIdx, Len(generics) - 1):
|
||||
var prc = generics[i].instSym
|
||||
if prc.kind in {skProc, skMethod, skConverter} and prc.magic == mNone:
|
||||
if prc.ast == nil or prc.ast.sons[codePos] == nil:
|
||||
InternalError(prc.info, "no code for " & prc.name.s)
|
||||
addSon(n, prc.ast)
|
||||
c.lastGenericIdx = sonsLen(c.generics)
|
||||
lastGenericIdx = Len(generics)
|
||||
|
||||
proc semExprNoFlags(c: PContext, n: PNode): PNode =
|
||||
result = semExpr(c, n, {})
|
||||
|
|
@ -174,7 +172,7 @@ proc myOpenCached(module: PSym, filename: string,
|
|||
proc SemStmtAndGenerateGenerics(c: PContext, n: PNode): PNode =
|
||||
result = semStmt(c, n)
|
||||
# BUGFIX: process newly generated generics here, not at the end!
|
||||
if sonsLen(c.generics) > 0:
|
||||
if lastGenericIdx < Len(generics):
|
||||
var a = newNodeI(nkStmtList, n.info)
|
||||
addCodeForGenerics(c, a)
|
||||
if sonsLen(a) > 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue