This commit is contained in:
Andreas Rumpf 2020-03-27 12:14:57 +01:00 • committed by GitHub
commit 0a49fe5fad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -1503,6 +1503,13 @@ proc containsCompileTimeOnly*(t: PType): bool =
return true
return false
proc safeSkipTypes*(t: PType, kinds: TTypeKinds): PType =
## same as 'skipTypes' but with a simple cycle detector.
result = t
var seen = initIntSet()
while result.kind in kinds and not containsOrIncl(seen, result.id):
result = lastSon(result)
type
OrdinalType* = enum
NoneLike, IntLike, FloatLike