An unnamed break in a block now gives an UnnamedBreak warning (#20901)
* unnamed break in the block now gives an error * bootstrap * fixes * more fixes * break with label * label again * one moee * Delete test5.txt * it now gives a UnnamedBreak warning * change the URL of bump back to the original one
This commit is contained in:
parent
d149727f34
commit
ef29987781
16 changed files with 85 additions and 20 deletions
|
|
@ -2640,6 +2640,8 @@ include semobjconstr
|
|||
proc semBlock(c: PContext, n: PNode; flags: TExprFlags; expectedType: PType = nil): PNode =
|
||||
result = n
|
||||
inc(c.p.nestedBlockCounter)
|
||||
let oldBreakInLoop = c.p.breakInLoop
|
||||
c.p.breakInLoop = false
|
||||
checkSonsLen(n, 2, c.config)
|
||||
openScope(c) # BUGFIX: label is in the scope of block!
|
||||
if n[0].kind != nkEmpty:
|
||||
|
|
@ -2657,6 +2659,7 @@ proc semBlock(c: PContext, n: PNode; flags: TExprFlags; expectedType: PType = ni
|
|||
if isEmptyType(n.typ): n.transitionSonsKind(nkBlockStmt)
|
||||
else: n.transitionSonsKind(nkBlockExpr)
|
||||
closeScope(c)
|
||||
c.p.breakInLoop = oldBreakInLoop
|
||||
dec(c.p.nestedBlockCounter)
|
||||
|
||||
proc semExportExcept(c: PContext, n: PNode): PNode =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue