diff options
Diffstat (limited to 'compiler/seminst.nim')
-rw-r--r-- | compiler/seminst.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/seminst.nim b/compiler/seminst.nim index 37f081dbc..84ae9a26f 100644 --- a/compiler/seminst.nim +++ b/compiler/seminst.nim @@ -345,7 +345,8 @@ proc generateInstance(c: PContext, fn: PSym, pt: TypeMapping, # generates an instantiated proc if c.instCounter > 50: globalError(c.config, info, "generic instantiation too nested") - inc(c.instCounter) + inc c.instCounter + defer: dec c.instCounter # careful! we copy the whole AST including the possibly nil body! var n = copyTree(fn.ast) # NOTE: for access of private fields within generics from a different module @@ -439,7 +440,6 @@ proc generateInstance(c: PContext, fn: PSym, pt: TypeMapping, popOwner(c) c.currentScope = oldScope discard c.friendModules.pop() - dec(c.instCounter) c.matchedConcept = oldMatchedConcept if result.kind == skMethod: finishMethod(c, result) |