From 604dfebee0febc2244163069cf7583e005c7c9df Mon Sep 17 00:00:00 2001 From: Araq Date: Thu, 18 Oct 2018 17:42:57 +0200 Subject: disallow 'continue' that is not used within a loop; fixes #6367 --- compiler/semstmts.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/semstmts.nim') 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})) -- cgit 1.4.1-2-gfad0 e Nim compiler, Nim's stdlib, tools, and documentation. (mirror)ahoang <ahoang@tilde.institute>
summary refs log blame commit diff stats
path: root/web/download.txt
blob: 59ecdc3f5d1c9c9b4dc3eea3f6e50609e5cc5682 (plain) (tree)
1
2
3
4
5
6
7
8
9
10