This commit is contained in:
Araq 2018-08-28 11:16:37 +02:00
commit 9c3cba1c22
2 changed files with 21 additions and 1 deletions

View file

@ -326,7 +326,8 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
# no need to instantiate generic templates/macros:
internalAssert c.config, fn.kind notin {skMacro, skTemplate}
# generates an instantiated proc
if c.instCounter > 1000: internalError(c.config, fn.ast.info, "nesting too deep")
if c.instCounter > 50:
globalError(c.config, info, "generic instantiation too nested")
inc(c.instCounter)
# careful! we copy the whole AST including the possibly nil body!
var n = copyTree(fn.ast)