implements `distinct with/without X, Y`

This still doesn't work quite right, because some common operations like array
indexing lay completely outside the scope/symbol lookup system - they are not
even magics.
This commit is contained in:
Zahary Karadjov 2014-03-20 01:15:20 +02:00
commit 8a0509b3b2
5 changed files with 72 additions and 27 deletions

View file

@ -139,13 +139,12 @@ proc semVarType(c: PContext, n: PNode, prev: PType): PType =
addSonSkipIntLit(result, base)
else:
result = newConstraint(c, tyVar)
proc semDistinct(c: PContext, n: PNode, prev: PType): PType =
if sonsLen(n) == 1:
result = newOrPrevType(tyDistinct, prev, c)
addSonSkipIntLit(result, semTypeNode(c, n.sons[0], nil))
else:
result = newConstraint(c, tyDistinct)
if n.len == 0: return newConstraint(c, tyDistinct)
result = newOrPrevType(tyDistinct, prev, c)
addSonSkipIntLit(result, semTypeNode(c, n.sons[0], nil))
if n.len > 1: result.n = n[1]
proc semRangeAux(c: PContext, n: PNode, prev: PType): PType =
assert isRange(n)