Tidy up isOrdinalType
This commit is contained in:
parent
e56da28bcf
commit
623e0763c2
1 changed files with 5 additions and 4 deletions
|
|
@ -148,10 +148,11 @@ proc skipGeneric(t: PType): PType =
|
||||||
|
|
||||||
proc isOrdinalType(t: PType): bool =
|
proc isOrdinalType(t: PType): bool =
|
||||||
assert(t != nil)
|
assert(t != nil)
|
||||||
|
const
|
||||||
# caution: uint, uint64 are no ordinal types!
|
# caution: uint, uint64 are no ordinal types!
|
||||||
result = t.kind in {tyChar,tyInt..tyInt64,tyUInt8..tyUInt32,tyBool,tyEnum} or
|
baseKinds = {tyChar,tyInt..tyInt64,tyUInt8..tyUInt32,tyBool,tyEnum}
|
||||||
(t.kind in {tyRange, tyOrdinal, tyConst, tyMutable, tyGenericInst}) and
|
parentKinds = {tyRange, tyOrdinal, tyConst, tyMutable, tyGenericInst}
|
||||||
isOrdinalType(t.sons[0])
|
t.kind in baseKinds or (t.kind in parentKinds and isOrdinalType(t.sons[0]))
|
||||||
|
|
||||||
proc enumHasHoles(t: PType): bool =
|
proc enumHasHoles(t: PType): bool =
|
||||||
var b = t
|
var b = t
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue