proper scoping for 'if'

This commit is contained in:
Araq 2013-04-30 14:40:54 +02:00
commit e70cc64e90
3 changed files with 12 additions and 11 deletions

View file

@ -1504,8 +1504,8 @@ proc semIf(c: PContext, n: PNode): PNode =
for i in countup(0, sonsLen(n) - 1):
var it = n.sons[i]
if it.len == 2:
it.sons[0] = forceBool(c, semExprWithType(c, it.sons[0]))
openScope(c.tab)
it.sons[0] = forceBool(c, semExprWithType(c, it.sons[0]))
it.sons[1] = semExprBranch(c, it.sons[1])
typ = commonType(typ, it.sons[1].typ)
closeScope(c.tab)