diff options
author | Andreas Rumpf <andreas@andreas-desktop> | 2010-08-08 22:45:21 +0200 |
---|---|---|
committer | Andreas Rumpf <andreas@andreas-desktop> | 2010-08-08 22:45:21 +0200 |
commit | 8098e2a421bf26ad0f350f297f19f34619207443 (patch) | |
tree | ada62dabe6a38c7fbe47d65e2674b9070f2cef3c /rod | |
parent | c9e011e36cf400e1a2e5466a1339f716623508f7 (diff) | |
download | Nim-8098e2a421bf26ad0f350f297f19f34619207443.tar.gz |
inlining of the write barrier for dlls
Diffstat (limited to 'rod')
-rwxr-xr-x | rod/semtempl.nim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/rod/semtempl.nim b/rod/semtempl.nim index f866f77d2..cb4288a56 100755 --- a/rod/semtempl.nim +++ b/rod/semtempl.nim @@ -57,18 +57,17 @@ proc evalTemplateAux(c: PContext, templ, actual: PNode, sym: PSym): PNode = result.sons[i] = evalTemplateAux(c, templ.sons[i], actual, sym) var evalTemplateCounter: int = 0 + # to prevend endless recursion in templates instantation proc evalTemplateArgs(c: PContext, n: PNode, s: PSym): PNode = - # to prevend endless recursion in templates - # instantation var f, a: int arg: PNode f = sonsLen(s.typ) # if the template has zero arguments, it can be called without ``()`` # `n` is then a nkSym or something similar case n.kind - of nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand, nkCallStrLit: a = sonsLen( - n) + of nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand, nkCallStrLit: + a = sonsLen(n) else: a = 0 if a > f: liMessage(n.info, errWrongNumberOfArguments) result = copyNode(n) @@ -85,7 +84,8 @@ proc evalTemplate(c: PContext, n: PNode, sym: PSym): PNode = var args: PNode inc(evalTemplateCounter) if evalTemplateCounter > 100: - liMessage(n.info, errTemplateInstantiationTooNested) # replace each param by the corresponding node: + liMessage(n.info, errTemplateInstantiationTooNested) + # replace each param by the corresponding node: args = evalTemplateArgs(c, n, sym) result = evalTemplateAux(c, sym.ast.sons[codePos], args, sym) dec(evalTemplateCounter) |