diff options
Diffstat (limited to 'compiler/sem.nim')
-rwxr-xr-x | compiler/sem.nim | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim index 19b3cc9e2..c2fbfff72 100755 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -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: |