minor breaking change: for loop bodies now get their own scope

This commit is contained in:
Andreas Rumpf 2017-11-05 16:53:05 +01:00
commit 4e4d466d06
4 changed files with 14 additions and 0 deletions

View file

@ -697,7 +697,9 @@ proc semForVars(c: PContext, n: PNode): PNode =
if sfGenSym notin v.flags and not isDiscardUnderscore(v):
addForVarDecl(c, v)
inc(c.p.nestedLoopCounter)
openScope(c)
n.sons[length-1] = semStmt(c, n.sons[length-1])
closeScope(c)
dec(c.p.nestedLoopCounter)
proc implicitIterator(c: PContext, it: string, arg: PNode): PNode =