new shift ops for Nim; based on #4743

This commit is contained in:
Andreas Rumpf 2016-12-29 12:07:20 +01:00
commit 9c4a60193f
3 changed files with 58 additions and 27 deletions

View file

@ -243,7 +243,16 @@ proc makeAndType*(c: PContext, t1, t2: PType): PType =
proc makeOrType*(c: PContext, t1, t2: PType): PType =
result = newTypeS(tyOr, c)
result.sons = @[t1, t2]
if t1.kind != tyOr and t2.kind != tyOr:
result.sons = @[t1, t2]
else:
template addOr(t1) =
if t1.kind == tyOr:
for x in t1.sons: result.rawAddSon x
else:
result.rawAddSon t1
addOr(t1)
addOr(t2)
propagateToOwner(result, t1)
propagateToOwner(result, t2)
result.flags.incl((t1.flags + t2.flags) * {tfHasStatic})