proper scoping for 'if'
This commit is contained in:
parent
d64d6a70d4
commit
e70cc64e90
3 changed files with 12 additions and 11 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue