summary refs log tree commit diff stats
path: root/nim/semstmts.pas
diff options
context:
space:
mode:
Diffstat (limited to 'nim/semstmts.pas')
-rw-r--r--nim/semstmts.pas3
1 files changed, 2 insertions, 1 deletions
diff --git a/nim/semstmts.pas b/nim/semstmts.pas
index ebf14693c..a5242b526 100644
--- a/nim/semstmts.pas
+++ b/nim/semstmts.pas
@@ -354,7 +354,8 @@ var
 begin
   result := n;
   checkSonsLen(n, 1);
-  if (c.p.owner = nil) or (c.p.owner.kind <> skIterator) then
+  if (c.p.owner = nil) or (c.p.owner.kind <> skIterator)
+  or (c.p.nestedLoopCounter <= 0) then
     liMessage(n.info, errYieldNotAllowedHere);
   if (n.sons[0] <> nil) then begin
     n.sons[0] := SemExprWithType(c, n.sons[0]);