bugfix: overlap checking for 'case'

This commit is contained in:
Araq 2013-01-27 22:58:21 +01:00
commit d5a5c2291f
4 changed files with 25 additions and 10 deletions

View file

@ -47,9 +47,9 @@ proc inSet(s: PNode, elem: PNode): bool =
proc overlap(a, b: PNode): bool =
if a.kind == nkRange:
if b.kind == nkRange:
# X..Y and C..D overlap iff (X <= D and C <= Y)
result = leValue(a.sons[0], b.sons[1]) and
leValue(b.sons[1], a.sons[1]) or
leValue(a.sons[0], b.sons[0]) and leValue(b.sons[0], a.sons[1])
leValue(b.sons[0], a.sons[1])
else:
result = leValue(a.sons[0], b) and leValue(b, a.sons[1])
else: