summary refs log tree commit diff stats
path: root/nim/sem.pas
diff options
context:
space:
mode:
authorrumpf_a@web.de <>2009-10-27 22:28:02 +0100
committerrumpf_a@web.de <>2009-10-27 22:28:02 +0100
commitd5acb88cccecf54bcc9a7c13f4fbaa095a8b37d4 (patch)
treeda88c98e8bd063f7991d2e2cba5797351d301eba /nim/sem.pas
parent053309e60aee1eda594a4817ac8ac2fb8c18fb04 (diff)
downloadNim-d5acb88cccecf54bcc9a7c13f4fbaa095a8b37d4.tar.gz
bugfixes: macros; splitFile; strutils.split; iterator.method
Diffstat (limited to 'nim/sem.pas')
-rwxr-xr-xnim/sem.pas7
1 files changed, 6 insertions, 1 deletions
diff --git a/nim/sem.pas b/nim/sem.pas
index 64cdbd436..a5d28d734 100755
--- a/nim/sem.pas
+++ b/nim/sem.pas
@@ -130,12 +130,17 @@ begin
   end
 end;
 
+{$include 'semtempl.pas'}
+
 function semMacroExpr(c: PContext; n: PNode; sym: PSym;
                       semCheck: bool = true): PNode;
 var
   p: PEvalContext;
   s: PStackFrame;
 begin
+  inc(evalTemplateCounter);
+  if evalTemplateCounter > 100 then
+    liMessage(n.info, errTemplateInstantiationTooNested);
   markUsed(n, sym);
   p := newEvalContext(c.module, '', false);
   s := newStackFrame();
@@ -150,9 +155,9 @@ begin
   if cyclicTree(result) then liMessage(n.info, errCyclicTree);
   if semCheck then
     result := semAfterMacroCall(c, result, sym);
+  dec(evalTemplateCounter);
 end;
 
-{$include 'semtempl.pas'}
 {$include 'seminst.pas'}
 {$include 'sigmatch.pas'}