diff options
author | Matthew Baulch <baulch.matt@gmail.com> | 2016-08-11 21:09:34 +1000 |
---|---|---|
committer | Matthew Baulch <baulch.matt@gmail.com> | 2016-08-11 21:09:34 +1000 |
commit | 623e0763c2df1aa49a516775ba5e43fa4e258ba2 (patch) | |
tree | 86c1b58fee0c7f9e7988eeb5c61e96210a977c60 /compiler | |
parent | e56da28bcf66f2ce68446b4422f887799d7b6c61 (diff) | |
download | Nim-623e0763c2df1aa49a516775ba5e43fa4e258ba2.tar.gz |
Tidy up isOrdinalType
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/types.nim | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/types.nim b/compiler/types.nim index c56382b89..442db8ec9 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -148,10 +148,11 @@ proc skipGeneric(t: PType): PType = proc isOrdinalType(t: PType): bool = assert(t != nil) - # caution: uint, uint64 are no ordinal types! - result = t.kind in {tyChar,tyInt..tyInt64,tyUInt8..tyUInt32,tyBool,tyEnum} or - (t.kind in {tyRange, tyOrdinal, tyConst, tyMutable, tyGenericInst}) and - isOrdinalType(t.sons[0]) + const + # caution: uint, uint64 are no ordinal types! + baseKinds = {tyChar,tyInt..tyInt64,tyUInt8..tyUInt32,tyBool,tyEnum} + parentKinds = {tyRange, tyOrdinal, tyConst, tyMutable, tyGenericInst} + t.kind in baseKinds or (t.kind in parentKinds and isOrdinalType(t.sons[0])) proc enumHasHoles(t: PType): bool = var b = t |