summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-10-18 17:42:57 +0200
committerAraq <rumpf_a@web.de>2018-10-18 17:42:57 +0200
commit604dfebee0febc2244163069cf7583e005c7c9df (patch)
treeb03cce88d39b29bbfdbce71dd8d65b562f4246e7 /compiler/semstmts.nim
parentc64391e30b22b7ca2c97adde22e6258e5d2463fb (diff)
downloadNim-604dfebee0febc2244163069cf7583e005c7c9df.tar.gz
disallow 'continue' that is not used within a loop; fixes #6367
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 0ace01bc5..a286cdc85 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -66,7 +66,7 @@ proc semBreakOrContinue(c: PContext, n: PNode): PNode =
         localError(c.config, n.info, errInvalidControlFlowX % s.name.s)
     else:
       localError(c.config, n.info, errGenerated, "'continue' cannot have a label")
-  elif (c.p.nestedLoopCounter <= 0) and (c.p.nestedBlockCounter <= 0):
+  elif (c.p.nestedLoopCounter <= 0) and ((c.p.nestedBlockCounter <= 0) or n.kind == nkContinueStmt):
     localError(c.config, n.info, errInvalidControlFlowX %
                renderTree(n, {renderNoComments}))